About ODFPY links

Terry Reedy tjreedy at udel.edu
Wed May 6 19:02:59 EDT 2009


shruti surve wrote:
> hey all,
>  For my project, i am using ODFpy open office spreadsheets. I am 
> creating ledgers in python ie.ledger.py <http://ie.ledger.py>.  So when 
> i run ledger.py, spreadsheet will be opened in open office. since ledger 
> is made of number of accounts, i am creating multiple tables for all 
> accounts in single spreadsheet. So, there are number of tables in one 
> spreadsheet.  Now i want create links in each table of spreadsheet so 
> that i can connect multiple tables. SO can anyone please tell me how to 
> create links in odfpy..

The general answer to such questions is to make a minimal doc in some 
ODF application such of OOo that has the desired feature, save, open the 
doc as a zip file (unless saved as xml) and extract the pieces as xml. 
Then find the text that represents that feature.  There is a close 
correspondance between the xml and the internal document object model 
created by odfpy (and OOo, etc).

In your case, make a spreadsheet with two table.  Give one one literal 
entry.  Give the other one entry that links to the first.  Then look in 
the xml to see how links are presented.  That should give a hint as to 
how to do the same in odfpy.  Then try to recreate the minimal doc with 
odfpy and look at the xml *it* produces.  If it looks similar enough, 
open with OOo to see what you get.

tjr




More information about the Python-list mailing list