Python-list Digest, Vol 68, Issue 79

shruti surve sasurve at gmail.com
Thu May 7 02:46:26 EDT 2009


>
>
>   3. Re: About ODFPY links (Terry Reedy)
>
>
>
>
>
>
> ---------- Forwarded message ----------
> From: Terry Reedy <tjreedy at udel.edu>
> To: python-list at python.org
> Date: Wed, 06 May 2009 19:02:59 -0400
> Subject: Re: About ODFPY links
> 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



hi
 i have tried that and i found <text:p><text:a xlink:href="#Sheet2"
office:target-frame-name="_self">Investments</text:a></text:p>...so in my
ledger.py i have written:

            para = P(text=lst_debit[i][0])


lan=A(href=lst_debit[i][0],targetframename="_self",text=lst_debit[i][0])

            lan.addElement(para)
            tc.addElement(lan)

            tr.addElement(tc)
(where lst_debit[i][0] is my account name coming from database)

 but still its not coming erroris :
in addElement
odf.element.IllegalChild: <text:p> is not allowed in <text:a>


i have tried it with:

tc.addElement(P(text=lst_credit[i][0]),A(href=lst_debit[i][0],targetframename="_self"))

but still its not coming, it is not giving any error, but not creating link,
giving simple text field.. so i basically i am not getting how to manage P
and A properties of cell together

Regards
shruti surve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090507/b191f3f5/attachment.html>


More information about the Python-list mailing list