Peguei essa função não sei de onde.
gero um dbf e chamo a função
estou tentando ver se funciona + da pau
auguem usa algo parecido ?
*** Grafico EXCELL
FUNCTION gpizza_excell( excell_programa, excell_nprograma )
LOCAL oExcel, oSheet, oPlan
LOCAL nCounter
*select axxabc
*msgstop(strzero(recno(),6))
cTempDir := "c:\dbdc\excell"
TRY
oExcel := GetActiveObject( "Excel.Application" )
CATCH
TRY
oExcel := CreateObject( "Excel.Application" )
CATCH
pmsg= "ERRO! Excel nÆo Instalado. [" + Ole2TxtError()+ "]"
ftempo()
RETURN
END
END
msgstop("gpizza_exell 01")
oExcel:WorkBooks:Add() && da pau aqui
msgstop("gpizza_exell 02")
oSheet = oExcel:ActiveSheet()
msgstop("gpizza_exell 03")
*if File(cTempDir+[\]+alltrim(pusuario)+".xls")
* fErase(cTempDir+[\]+alltrim(pusuario)+".xls")
* oSheet:SaveAs(cTempDir+[\]+alltrim(pusuario)+".xls")
*else
* oSheet:SaveAs(cTempDir+[\]+alltrim(pusuario)+".xls")
*endif
oSheet:Cells:Font:Name = "Courier New"
oSheet:Cells:Font:Size = 17
oSheet:cells:Font:ColorIndex := 11
oSheet:Cells( 1, 1 ):Value := trim(pnomeapl)
msgstop("gpizza_exell 04")
oSheet:Cells:Font:Name = "Courier New"
oSheet:Cells:Font:Size = 12
oSheet:Cells( 3, 1 ):Value := hb_oemtoansi("Descri‡Æo")
oSheet:Cells( 3, 2 ):Value := "Valor"
msgstop("gpizza_exell 05")
oSheet:cells:Font:ColorIndex := 00 && qual a cor BLACK ?
*oSheet:Columns( 1 ):Font:Bold := .T.
oSheet:Columns( 1 ):AutoFit()
oSheet:Columns( 2 ):AutoFit()
msgstop("gpizza_exell 06")
nCounter := 5
cMEMO:=""
C:=1
B:=len(MATA)
msgstop("gpizza_exell 02")
DO WHILE C <= B
// 1 2 3 4 5 6 7 8
//{ DESCRICAO, VALOR, CUSTO->ICMS, CUSTO->IPI, CUSTO->UNIDADE, CUSTO->TAXADF, STR(RECNO(),6), CUSTO->PRECUSTO } )
cMEMO += MATA[C,1] // 1- DESCRICAO
cMEMO += CHR(9)+TRANSF(MATA[C,2] , "@E 99,999,999.9999") // 2- Valor
cMEMO += CHR(10)
*Mudar a cor das linhas sob condicoes
*if testtemp->qtd <= 0
* oExcel:Rows(nCounter):Font:ColorIndex := 3
*else
* oExcel:Rows(nCounter):Font:ColorIndex := 11
*endif
if C = (B-1) && Ultima linha
oSheet:Columns( 1 ):Font:Bold := .T.
endif
*112009 GTSetClipboard( cMemo ) xhb NOVO
oSheet:Cells( nCounter, 1 ):Select()
oSheet:paste()
cMemo := ''
C++
nCounter++
ENDDO
*oSheet:Columns( 1 ):Font:Bold := .T.
msgstop("gpizza_exell 03")
nCounter = nCounter - 1
oSheet:Columns( "A:B" ):AutoFit()
*oSheet:Cells( 4,nCounter ):Select() && NAO Seleciona as linhas
oExcel:Visible = .T.
RETURN( nil )
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *