Hello,
Can anybody tell me what to use for the CreateObject when creating a spreadsheet in Open Office? I have a customer who does not use Microsoft Office.
oXL := CreateObject("Excel.Application???")
TIA
David
Hello,
Can anybody tell me what to use for the CreateObject when creating a spreadsheet in Open Office? I have a customer who does not use Microsoft Office.
oXL := CreateObject("Excel.Application???")
TIA
David
TRY
oExcel := GetActiveObject( "com.sun.star.ServiceManager" )
CATCH
TRY
oExcel := CreateObject( "com.sun.star.ServiceManager" )
CATCH
VALERT ( "OpenOffice no install", , , "X",,.t.,,{"aceptar"})
return 0
END
END
oDesktop = oExcel:CreateInstance( "com.sun.star.frame.Desktop" )
oDoc = oDesktop:LoadComponentFromURL( "private:factory/scalc", "_blank", 0, {} )
oHoja = oDoc:GetSheets():GetByIndex( 0 )
oHoja:CharFontName = "Arial"
oHoja:CharHeight = 10
oHoja:GetCellByPosition( 0, 0 ):SetString := "String text"
oHoja:GetCellByPosition( 0, 0 ):CharHeight = 16 // fontsize
oHoja:GetCellByPosition( 0, 0 ):CharWeight = 150 // bold
oHoja:GetCellByPosition( 0, 0 ):CharColor = 8388608 // blue color
Please study the METHOD ToCalc() in xbrowse.prg.
This provides a good example of creating a spread sheet with open office and exporting data to the sheet.
By the way, if MS Office is not installed and Open Office is detected, xbrowse automatically exports data to Open Office spreadsheet when we use oBrw:ToExcel()
Thanks Guys,
Just needed the keywords to search the forum.
David ![]()