I looked into the code of Xbrowse to find out how ToCsv is working. I see that the delimeter is hard code as a comma ( , )
I need i to be ( ; )
Is it a idea to add this option into Xbrowse source ? (extra : cDelimiter)
Or is there a other way ?
I prefer NOT to change source of FWH in order to keep the updates.
I do have read that it is possible to subclass from a source of FWH.
Just out of interest how this could work for my learning curve, maybe someone can use this code from source (Xbrowse) and make this work
I just named it MY_ToCSV (reference that it is My version) Then I can change the "," into ";" without Mr. Rao to change the sources of FWH
Code: Select all
METHOD MY_ToCSV( cFile, aCols, lHeaders, cTrue, cFalse ) CLASS TXBrowse
local cCsv := ""
local n, cLine, uVal, c, uBm, hFile
local oExcel, oBook
if aCols == nil
aCols := ::GetVisibleCols()
else
AEval( aCols, { |o,i| aCols[ i ] := ::oCol( o ) } )
endif
DEFAULT lHeaders := .t., cTrue := cXlTrue, cFalse := cXlFalse
if lHeaders
for n := 1 to Len( aCols )
if n > 1
cCsv += ","
endif
cCsv += '"' + StrTran( aCols[ n ]:cHeader, CRLF, " " ) + '"'
next
endif
uBm := ::BookMark
Eval( ::bGoTop )
REPEAT
cLine := ""
for n := 1 to Len( aCols )
c := ""
uVal := aCols[ n ]:Value
c := FW_ValToCSV( uVal, cTrue, cFalse )
if n > 1
cLine += ","
endif
cLine += c
next
if !Empty( cCsv )
cCsv += CRLF
endif
cCsv += cLine
UNTIL Eval( ::bSkip, 1 ) == 0
::BookMark := uBm
if !Empty( cFile )
cFile := TrueName( cFile )
if ( hFile := fCreate( cFile, 0 ) ) > 0
fWrite( hFile, cCsv )
fClose( hFile )
cCsv := nil
endif
endif
return IfNil( cFile, cCsv )