Page 1 of 1
Creating a spreadsheet using Open Office
Posted: Fri Sep 05, 2014 4:10 pm
by David Williams
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
Re: Creating a spreadsheet using Open Office
Posted: Fri Sep 05, 2014 8:11 pm
by Manuel Valdenebro
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
Re: Creating a spreadsheet using Open Office
Posted: Sat Sep 06, 2014 3:49 am
by nageswaragunupudi
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()
Re: Creating a spreadsheet using Open Office
Posted: Sat Sep 06, 2014 4:35 pm
by David Williams
Thanks Guys,
Just needed the keywords to search the forum.
David