hola,
existe una funcion como FW_CopyDBF2XL(), pero para ArrayToXLS() ?
Gracias!
(cAlias)->( FW_DbfToExcel( [cFieldList], [bFor], [bWhile], [nNext], [nRec], [lRest], [cSaveToFileName] )
FW_CopyDBFTO( [cDestXLS], [cSourceDBF] )
function ArrayToExcel( aData )
local oExcel, oBook, oSheet
local nRow, nCol, nCols := 1
if ( oExcel := ExcelObj() ) == nil
? "Excel not instqalled"
else
oBook := oExcel:WorkBooks:Add()
oSheet := oBook:ActiveSheet
oExcel:ScreenUpdating := .f.
for nRow := 1 to Len( aData )
if ValType( aData[ nRow ] ) == "A"
nCols := Max( nCols, Len( aData[ nRow ] ) )
for nCol := 1 to Len( aData[ nRow ] )
oSheet:Cells( nRow, nCol ):Value := aData[ nRow, nCol ]
next
else
oSheet:Cells( nRow, 1 ):Value := aData[ nRow ]
endif
next
oSheet:Range( oSheet:Columns( 1 ), oSheet:Columns( nCols ) ):AutoFit()
oExcel:ScreenUpdating := .t.
oExcel:visible := .t.
endif
return nil
function ArrayToExcel2( aData )
local oExcel, oBook, oSheet
local cText, oClp, nCols := 0
if ( oExcel := ExcelObj() ) == nil
? "Excel not instqalled"
else
oBook := oExcel:WorkBooks:Add()
oSheet := oBook:ActiveSheet
oExcel:ScreenUpdating := .f.
aData := AClone( aData )
AEval( aData, { |a| nCols := Max( nCols, Len( a ) ) } )
AEval( aData, { |a,i| aData[ i ] := FW_ArrayAsList( a, Chr( 9 ) ) } )
cText := FW_ArrayAsList( aData, CRLF )
oClp := TClipboard():New()
oClp:SetText( cText )
oSheet:Cells( 1, 1 ):Select()
oSheet:Paste()
oClp:Clear()
oClp:End()
oSheet:Range( oSheet:Columns( 1 ), oSheet:Columns( nCols ) ):AutoFit()
oExcel:ScreenUpdating := .t.
oExcel:visible := .t.
endif
return nil
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 91 guests