Hola:
Gracias por la respuesta. Cuando abre excel, solo puedo ver la barra de iconos del excel y nada del contenido de las celdas. Esto a que se puede deber?
saludos
-----Mensaje original-----
De: guvoaII@... [mailto:guvoaII@...]En nombre de Jorge Accinelli
Enviado el: Lunes, 16 de Abril de 2007 01:22 p.m.
Para: guvoaII@...
Asunto: Re: [guvoaII] Ayuda para Excel en cavo 2.7
Pego un metodo que a mi me dio resultado,con un par de detalles que me pasaron aquien el grupoJorge AccinelliMETHOD PB_Excel( ) CLASS DgRanCau
LOCAL oExcel AS OBJECT
LOCAL oWorkBooks AS OBJECT
LOCAL oWorkSheet AS OBJECT
LOCAL oRange AS OBJECT
LOCAL oRangeBorders AS OBJECT
LOCAL k := 0 AS INT
LOCAL aArray AS ARRAY
LOCAL cRow := NULL_STRING AS STRING
LOCAL oServer AS OBJECT
LOCAL nSize AS DWORD
LOCAL t_uni := 0 AS DWORD
LOCAL t_kgs := 0 AS FLOAT
LOCAL nRec := 0 AS INTIF SELF:Browser:Server:Used
IF SELF:Browser:server:LastRec = 0
ErrorBox{SELF,"No hay datos aun!"}:show( )
RETURN SELF
ENDIF
ENDIFSELF:Pointer := Pointer{ POINTERHOURGLASS }// Instanciacion
oExcel := OleAutoObject{"Excel.Applicati on"}
IF !oExcel:Finit
infobox{SELF,"ERROR"," No se puede inicializar Excel!"}:Show( )
RETURN SELF
ENDIF
oWorkBooks := oExcel:WorkBooks
oWorkBooks:Add()
oWorkSheet := oExcel:ActiveSheet// Datos vía array
oServer := SELF:Browser:server
oServer:SuspendNotification( )
nRec := oServer:Recno
oServer:GoTop() aArray := ArrayNew ( oServer:LastRec, 6 )
nSize := oServer:LastRec
FOR k := 1 TO nSize
aArray[k] := { oServer:CAUSAL , oServer:NOMBRE, oServer:UNI, oServer:KILOS, oServer:PORCE_UNI, oServer:PORCE_ KGS }
t_uni += oServer:UNI
t_kgs += oServer:KILOS
oServer:Skip()
NEXT
oServer:GoTo(nRec)
oServer:ResetNotification()
oRange := oWorkSheet:[Range,"A7" , "F"+AllTrim( Str(Len(aArray) + 6 ))]
oRange:Value := aArray
// Subtítulos
oRange := oWorkSheet:[Range,"A6" ,"F6"]
oRange:Value := { "CAUSAL","NOMBRE"," UNI "," KGS "," % UNI "," % KGS " }
oRange:Font:Color := RGB(0,128,0)
oRange:Font:Bold := TRUE
// Manejos de Borders
oRange := oWorkSheet:[Range,"A6" , "F" + AllTrim(Str( Len(aArray) + 6 )) ]
oRangeBorders := oRange:BordersoRangeBorders:[item, 8]:Weight := 2 // Top
oRangeBorders:[item, 8]:ColorIndex := 11
oRangeBorders:[item, 8]:LineStyle := 1 oRangeBorders:[item, 9]:Weight := 2 // Bottom
oRangeBorders:[item, 9]:ColorIndex := 11
oRangeBorders:[item, 9]:LineStyle := 1 oRangeBorders:[item, 7]:Weight := 2 // Left
oRangeBorders:[item, 7]:ColorIndex := 11
oRangeBorders:[item, 7]:LineStyle := 1 oRangeBorders:[item, 10]:Weight := 2 // Right
oRangeBorders:[item, 10]:ColorIndex := 11
oRangeBorders:[item, 10]:LineStyle := 1 oRangeBorders:[item, 12]:Weight := 1 // Inside Horizontal
oRangeBorders:[item, 12]:ColorIndex := 11
oRangeBorders:[item, 12]:LineStyle := 1 oRangeBorders:[item, 11]:Weight := 1 // Inside Vertical
oRangeBorders:[item, 11]:ColorIndex := 11
oRangeBorders:[item, 11]:LineStyle := 1
cRow := AllTrim(Str(Len(aArray) +8))
oWorkSheet:[Range ,"F7" , "F"+cRow ]:NumberFormat := "###0,00"
oWorkSheet:[Range ,"E7" , "E"+cRow ]:NumberFormat := "#########0, 00"
oRange:Font:Size := 10
oRange:Font:Name := "Arial"
oRange:Columns:AutoFit()
// Totales
cRow := AllTrim(Str(Len(aArray) +7))
oWorkSheet:[Range ,"A"+cRow , "A"+cRow ]:Value := "TOTALES"
oWorkSheet:[Range ,"C"+cRow , "C"+cRow ]:Value := t_uni
oWorkSheet:[Range ,"D"+cRow , "D"+cRow ]:Value := t_kgs
oWorkSheet:[Range ,"A"+cRow , "F"+cRow ]:Font:Color := RGB(0,128,0)
oWorkSheet:[Range ,"A"+cRow , "F"+cRow ]:Font:Bold := TRUE
// Titulos
oRange := oWorkSheet:[Range,"A1" ,"A1"]
oRange:Value := cNomEmp
oRange:Font:Color := RGB(0,0,157)
oRange:Font:size := 15
oRange:Font:Name := "Arial" // Informe
oRange := oWorkSheet:[Range,"A2" ,"A2"]
oRange:Value := "RANKING DE CAUSALES DE RETRABAJO"
oRange:Font:Color := RGB(0,0,200)
oRange:Font:size := 13
oRange:Font:Name := "Arial" // Periodo
oRange := oWorkSheet:[Range,"A3" ,"A3"]
oRange:Value := "PERIODO: " + DToS(SELF:oDCDateTimePicker1: SelectedDate) + " - " + DToS(SELF:oDCDateTi mePicker2: SelectedDate)
oRange:Font:size := 12
oRange:Font:Name := "Arial" // Visible
oWorkSheet:[RANGE,"F1" ,"f1"]:SELECT( )
oExcel:visible := TRUESELF:Pointer := Pointer{ POINTERARROW }
// Cierro
oWorkBooks:DestroyOleObject( )
oWorkBooks := NULL_OBJECT
oWorkSheet:DestroyOleObject( )
oWorkSheet := NULL_OBJECT
oExcel:DestroyOleObject()
oExcel := NULL_OBJECT
CollectForced() RETURN SELF----- Original Message -----From: Oscar MaciasSent: Monday, April 16, 2007 2:29 PMSubject: [guvoaII] Ayuda para Excel en cavo 2.7
Hola, tenía una aplicacion para generar una hoja de excel desde cavo 2.6, al cambiar a cavo 2.7 no me funciona y no inicia la aplicacion.Alguno me puede ayudar al respecto?Gracias
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 269.4.0/762 - Release Date: 15/04/2007 04:22 p.m.