Não funcionou,
A impressão que eu tenho é que tem que ter o office excel, word, etc instalado pra funcionar

Moderador: Moderadores
With Object oSheet1 := oExcel:ActiveSheet
//:Shapes:addPicture("P:\GERAL\HARBOUR\TESTE.JPG", 0, 1, 5, 5, 100, 100)
// Ou
:Cells( 1, 1 ):Select()
:Pictures:Insert( "P:\GERAL\HARBOUR\TESTE.JPG" ):Select()
End
oExcel := Win_OleCreateObject( "Excel.Application" )
xlMaximized := -4137
xlMinimized := -4140
xlNormal := -4143
WITH OBJECT oExcel
:DisplayAlerts := .F.
:ScreenUpdating := .F.
:Visible := .F.
:WorkBooks:Add()
:Sheets:Add()
oSheet := :ActiveSheet
END
HB_CDPSELECT( "PTISO" )
WITH OBJECT oSheet
:Name := "BOLETIM QUANTITATIVO"
:Cells( 1, 1 ):Select()
:Cells( 1, 2 ):Value := Hb_Eol() + Space(50) + "SECRETARIA MUNICIPAL DE FAZENDA" + ;
Hb_Eol() + Space(50) + "SUBSECRETARIA DE GESTÃO" + ;
Hb_Eol() + Space(50) + "GERÊNCIA DE RECURSOS HUMANOS"
FOR I:=1 TO 2
:Cells( I, 2 ):VerticalAlignment := xlVAlignTop
:Rows(1):RowHeight := 60
NEXT
oSheet:Range("A1:G4"):Merge()
:Shapes:addPicture("P:\GERAL\HARBOUR\FAZENDA.JPG", 0, 1, 5, 5, 100, 100)
//:Columns(2):ColumnWidth := 40
:Cells( 6, 1 ):Value := "CARGOS"
:Cells( 6, 1 ):Borders(2):LineStyle:= 1
:Cells( 6, 1 ):Borders(4):LineStyle:= 1
FOR I:=1 TO 6
:Cells( I, 1 ):Font:Bold := .T.
NEXT
nCol := 2
FOR EACH oElemento IN aColunas
IF ! Empty( oElemento[6] )
IF Trim( oElemento[6] ) = "SMF" .OR. Trim( oElemento[6] ) = "GERAL"
:Cells( 6, nCol ):Value := Trim( oElemento[5] ) + " " + Trim( oElemento[6] )
IF Trim( oElemento[6] ) = "GERAL"
:Cells( 6, nCol ):Borders(1):LineStyle := 1
ENDIF
ELSE
:Cells( 6, nCol ):Value := Trim( oElemento[5] ) + "/" + Trim( oElemento[6] )
ENDIF
ELSE
:Cells( 6, nCol ):Value := Trim( oElemento[5] )
ENDIF
:Cells( 6, nCol ):Font:Bold := .T.
:Cells( 6, nCol ):HorizontalAlignment := Centro
:Cells( 6, nCol ):Borders(4):LineStyle := 1
nCol ++
NEXT
nLin := 7
FOR EACH oElemento IN aCar
:Cells( nLin, 1 ):Value := oElemento
:Cells( nLin, 1 ):Borders(2):LineStyle := 1
:Cells( nLin, 1 ):Borders(4):LineStyle := 1
nCol := 2
FOR nLot := 1 TO Len( aTotal[ oElemento:__enumIndex ] )
IF aTotal[ oElemento:__enumIndex ][ nLot ] != 0
:Cells( nLin, nCol ):Value := Str( aTotal[ oElemento:__enumIndex ][ nLot ], 6 )
ENDIF
:Cells( nLin, nCol ):Borders(4):LineStyle := 1
nCol ++
NEXT
:Cells( nLin, nCol - 1 ):Borders(1):LineStyle := 1
nLin ++
NEXT
:Cells( nLin, 1 ):Value := "TOTAL GERAL"
nCol := 2
FOR nLot := 1 TO Len( aTotal[Len( aTotal )] )
IF aTotal[Len( aTotal )][nLot] != 0
:Cells( nLin, nCol ):Value := Str( aTotal[Len( aTotal )][nLot], 6 )
ENDIF
nCol ++
NEXT
nColunas := oSheet:UsedRange():Columns():Count
oExcel:Sheets("BOLETIM QUANTITATIVO"):Select()
:Columns():AutoFit()
END
WITH OBJECT oExcel
:ScreenUpdating := .T.
:Application:WindowState := xlMaximized
:ActiveWorkbook:SaveAs( "D:\TEMP_DRH\BOLETIM", 56 ) // 56 = xls, 61 = xlsx
:Visible := .T.
END
vimagem:='c:\logo.jpg'
oExcel:= TOleAuto():New( "Excel.Application" )
oExcel:WorkBooks:Add()
oSheet:= oExcel:Get( "ActiveSheet" )
oSheet:PageSetup:Orientation := 2 // 2 paisagem, 1=retrato
oSheet:PageSetup:PrintGridlines := .t.
oSheet:name:='RM 04'
oSheet:Cells:Font:Name := "Arial"
oSheet:Cells:Font:Size := 8
*---
vc1:=10
vc2:=25
vlf:='AO'
oSheet:Cells(1,1):Font:Size := 20
oSheet:Cells(1,1):Font:Bold := .T.
oSheet:Cells(1,1):HorizontalAlignment := -4108 //Centrar nome
oSheet:Cells(1,1):VerticalAlignment := -4108 //Centrar nome
oSheet:Cells(1,1):Value := 'Planejamento e Controle da Produ‡ao'
oSheet:Rows(1):RowHeight := 34
oSheet:Range("A1:V1"):Merge()
oSheet:Cells(1,1):Select()
if file(vimagem) //
oSheet:Shapes:addPicture(vimagem, 0, 1, 5, 5, -1, -1)
endif
*------------
oSheet:Cells(1,vc2):Font:Size := 20
oSheet:Cells(1,vc2):Font:Bold := .T.
oSheet:Cells(1,vc2):HorizontalAlignment := -4108 //Centrar nome
oSheet:Cells(1,vc2):VerticalAlignment := -4108 //Centrar nome
oSheet:Cells(1,vc2):Value :='Planejamento e Controle da Produ‡ao'
oSheet:Range('W1:'+vlf+'1'):Merge()
if file(vimagem) // nao funciona !!!!!!
oSheet:Cells(1,vc2):Select()
oSheet:Shapes:addPicture(vimagem, 0, 1, 5, 5, -1, -1)
endif
Usuários vendo este fórum: Itamar M. Lins Jr. e 3 visitantes