Bom dia senhores, alguém pode dar uma mãozinha aqui:
http://forums.fivetechsupport.com/viewtopic.php?f=6&t=29499
http://fivewin.com.br/index.php?/topic/22161-xbrowse-toexcel-problema-na-formatacao-numerica/#entry266255
Obg. abs.

Moderador: Moderadores
function ReporteXLS( oRPTLbx, cTitle, lPreview, cTitle2, aColunas )
local oRpt
local nRecNo := If( Upper( oRPTLbx:cAlias ) != "ARRAY", ( oRPTLbx:cAlias )->( RecNo() ), 0 )
local aData := Eval( oRPTLbx:bLine )
local n
local nCharWidth
local oRPTFont1, oRPTFont2, oRPTFont3
public nCreditos := 0
public nDebitos := 0
nCharWidth := GetTextWidth( 0, "B", If( oRPTLbx:oFont != nil, oRPTLbx:oFont:hFont, 0 ))
DEFAULT cTitle := oRPTLbx:oWnd:cTitle, lPreview := .t.
sColunas := ""
//FOR nPos = 1 TO LEN(aColunas)
// if aColunas[nPos] <> "0"
// sColunas := sColunas + str(nPos,1) + ";"
// endif
//NEXT
CursorWait()
Eval( oRPTLbx:bGoTop )
oExcel := TOleAuto():New( "Excel.Application" )
oExcel:WorkBooks:Add()
oPasta := oExcel:Get( "ActiveSheet" )
nRow := 1
for nCol := 1 TO len( oRPTLbx:aHeaders )
oPasta:Columns( nCol ):Font:Bold := .T.
if aColunas <> nil
if aColunas[ nCol ] = "0"
loop
else
oPasta:Cells( nRow, nCol ):Value := oRPTLbx:aHeaders[ nCol ]
endif
endif
next
nRow := 2
do while .t.
aData := Eval( oRPTLbx:bLine )
for nCol := 1 to len( oRPTLbx:aHeaders )
oPasta:Columns( nCol ):Font:Bold := .F.
if aColunas <> nil
if aColunas[ nCol ] = "0"
loop
else
oPasta:Cells( nRow, nCol ):Value := aData[ nCol ]
endif
endif
next
//oRPTLbx:Skip( 1 )
nRow := nRow + 1
skip
if Eof()
exit
endif
enddo
for nCol := 1 to len( oRPTLbx:aHeaders )
oPasta:Columns( nCol ):AutoFit()
next
oExcel:Visible := .T.
oPasta:End()
oExcel:End()
CursorArrow()
if Upper( oRPTLbx:cAlias ) != "ARRAY"
( oRPTLbx:cAlias )->( DbGoTo( nRecNo ) )
endif
oRPTLbx:Refresh()
return nil
Usuários vendo este fórum: Nenhum usuário registrado online e 4 visitantes