[Libreoffice] Python API and Danny.O00

Thorsten Behrens thb at documentfoundation.org
Thu Dec 16 03:20:24 PST 2010


Peter Morgan wrote:
> import LibreOffice as LO
> 
> spread_full_path = "/jobs/%s/my_calc_spread_sheet.odf" % JOB.job_id #
> whatever extension
> 
> spreadMe = LO.open(spread_full_path)
> 
> mySheet = spreadMe.sheet("foo", create=True) # create's if not exist,
> otherwise error
> 
> mySheet.append( My_Data )
> 
> mySheet.close()
> 
Hi Pete,

well you can use the normal Calc API also via Python, if Danny's
wrappers are not enough - it's almost as easy:

import uno, unohelper
...
oDoc = desktop.loadComponentFromURL( "file.ods", "_blank", 0, () )
oSheet = oDoc.getSheets().getByName( "My Sheet" )
oSheet.Rows.getByIndex(2).CellBackColor = long('00EEEEEE', 16)
...

etc - more details, bootstrapping tips etc here: 

http://wiki.services.openoffice.org/wiki/Python

(http://www.linuxjournal.com/content/starting-stopping-and-connecting-openoffice-python
may be a nice concise intro text)

> In conclusion:
> Anyone into developing the python.API and making it simple and idiot proff
> 
The "python API" is the normal LibO API, i.e. the same for Java,
Basic, Python etc - the python binding works well for me, Danny's
wrapper is nice - but he's the one to be asked for development
there.

Cheers,

-- Thorsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101216/31a090f3/attachment.pgp>


More information about the LibreOffice mailing list