Caros exportar rel para o excel nos jah falamos aqui no forum e tem varios exemplos. Mas alguem saberia me dizer como faco para exportar o relatorio para o excel e adicionar abas?
Marcos Roberto.

Moderador: Moderadores
FUNCTION MAIN()
LOCAL oExcel, oSheet
oExcel := TOleAuto():New( "Excel.Application" )
oExcel:WorkBooks:Add()
oSheet := oExcel:Get( "ActiveSheet" )
oSheet:Name := "Aba 1"
oSheet:Cells( 1, 1 ):Value := "Codigo"
oSheet:Cells( 1, 2 ):Value := "Nome"
oExcel:Sheets:Add()
oSheet := oExcel:Get( "ActiveSheet" )
oSheet:Name := "Aba 2"
oSheet:Cells( 1, 1 ):Value := "Data"
oSheet:Cells( 1, 2 ):Value := "Valor"
oSheet:Cells( 1, 1 ):Select()
oExcel:Visible := .T.
Return Nil
marcos.gurupi escreveu:No exemplo do Toledo como eu poderia preencher as celulas e principalmente como eu consigo manipular o tamanho das celulas.
oSheet:Cells( 2, 1 ):Value := "Nº"
oSheet:Cells( 2, 2 ):Value := " N O M E D O P A I"
oSheet:Cells( 2, 3 ):Value := " N O M E D O A L U N O"
oSheet:Cells( 2, 4 ):Value := "Ano"
oSheet:Cells( 2, 5 ):Value := "Mensalidade"
oSheet:Cells( 2, 6 ):Value := "Apostila"
oSheet:Cells( 2, 7 ):Value := "Xerox"
oSheet:Cells( 2, 8 ):Value := "Uniforme"
oSheet:Cells( 2, 9 ):Value := "R.O."
oSheet:Cells( 2, 10 ):Value := "Total"
oSheet:Columns(1):ColumnWidth := 3.86
oSheet:Columns(2):ColumnWidth := 40
oSheet:Columns(3):ColumnWidth := 40
oSheet:Columns(4):ColumnWidth := 7
oSheet:Columns(5):ColumnWidth := 6.43
oSheet:Cells( 1, 1 ):Font:Size := 14
oSheet:Cells( 1, 1 ):Font:Bold := .T.
oSheet:Cells( 2, 1 ):Font:Size := 10
oSheet:Cells( 1, 1 ):HorizontalAlignment:= -4108 //Centro
oSheet:Cells( 1, 2 ):HorizontalAlignment:= -4131 //Esquerda
oSheet:Cells( 1, 3 ):HorizontalAlignment:= -4152 //Direita
oSheet:Range("A2:M2"):HorizontalAlignment:= -4131 //Esquerda de A2 até M2
oSheet:Range("A1:M1"):Merge()
oSheet:Cells:Font:Name := "Times New Roman"
oSheet:Cells:Font:Size := 9
oSheet:Cells( 1, 5 ):Set( "NumberFormat", "#.##0,00" )
oSheet:Cells( 1, 1 ):Font:ColorIndex := 3
oSheet:Cells( 1, 2 ):Interior:ColorIndex := 7
Preto = 1
Branco = 2
Azul = 5
Azul Claro = 41
Azul Escuro = 11
Verde = 10
Vermelho = 3
Amarelo = 6
Marron = 53
Violeta = 13
Laranja = 46
Rosa = 7
oSheet:Range("A2:M10"):Borders(1):LineStyle:= 1
oSheet:Range("A2:M10"):Borders(2):LineStyle:= 1
oSheet:Range("A2:M10"):Borders(3):LineStyle:= 1
oSheet:Range("A2:M10"):Borders(4):LineStyle:= 1
function trataCamposExcel
local x,mcampo
for x=1 to len(v_est)
mcampo=v_est[x,1]
do case
case v_est[x,2] == "C"
cCell := "'"+alltrim(&mcampo)
case v_est[x,2] == "N"
cCell := &mcampo
case v_est[x,2] == "L"
cCell := if (&mcampo, "Sim", "Näo")
case v_est[x,2] == "D"
cCell := &mcampo
otherwise
cCell := "error"
endcase
oSheet:Cells( linha, x ):Value = cCell
next
return(nil)
oSheet:Protect("sua_senha")
Usuários vendo este fórum: Bing [Bot], Google [Bot] e 10 visitantes