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
Creating a spreadsheet using Open Office
- David Williams
- Posts: 82
- Joined: Fri Mar 03, 2006 6:26 pm
- Location: Ireland
- Manuel Valdenebro
- Posts: 706
- Joined: Thu Oct 06, 2005 9:57 pm
- Location: Málaga-España
Re: Creating a spreadsheet using Open Office
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
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
Un saludo
Manuel
Manuel
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Creating a spreadsheet using Open Office
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()
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()
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- David Williams
- Posts: 82
- Joined: Fri Mar 03, 2006 6:26 pm
- Location: Ireland
Re: Creating a spreadsheet using Open Office
Thanks Guys,
Just needed the keywords to search the forum.
David
Just needed the keywords to search the forum.
David