XHTML data to embed in Existing ODT file

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
Priyanka
Posts: 3
Joined: Thu Jul 10, 2008 10:01 am

XHTML data to embed in Existing ODT file

Post by Priyanka »

Welcome beginner. Please answer all of the questions below which may provide information necessary to answer your question.
-----------------------------------------------------------------------------------------------------------
Open Office 2.0
Windows 2000
I want to add the XHTML data inputted from another editor into an existing ODT file?
I have tested the python open document to add the XHTML data into ODT file but it doesnt add the data properly like style are missing that are present in XHTML data.
Is there any way through which we can add the XHTML data into ODT file through coding?
OOo 2.0.X on Ms Windows Other
User avatar
Hagar Delest
Moderator
Posts: 33629
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: XHTML data to embed in Existing ODT file

Post by Hagar Delest »

First, you should upgrade to latest 2.4.1 because 2.0 is really deprecated now.

Can you make a small example of your coding and post it here? Is it implemented in the content.xml file?

NB: moved the thread to the Setup and Troubleshouting forum.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE 7 Gigi) and 25.2 portable on Windows 11.
Priyanka
Posts: 3
Joined: Thu Jul 10, 2008 10:01 am

Re: XHTML data to embed in Existing ODT file

Post by Priyanka »

The template odt file is attached and the xhtml data replaced the text at (This text will be replaced)
This is the test python file that i am using
-----------------------------------------------------------------------------------------------------------------------------
from appy.pod.renderer import Renderer

xhtmldata = '<p class="P7">Hello World</p>'

renderer = Renderer('c:/python25/new.odt', globals(), 'c:/python25/result.odt')
renderer.run()
-----------------------------------------------------------------------------------------------------------------------------

Here my problem is the styles defined in Xhtml data when rendered through the POD in template.odt does not have the styles as defined. Here the style P7 is already present in the template odt file. Can you please tell how to do the mapping of styles that are present in xhtml to template odt file.
Attachments
new.odt
the template odt file
(22.61 KiB) Downloaded 421 times
OOo 2.0.X on Ms Windows Other
Priyanka
Posts: 3
Joined: Thu Jul 10, 2008 10:01 am

Modify a existing ODT by inserting the XHTML data

Post by Priyanka »

Problem :

I have to generate a report in ODT format. This report contains both static data and dynamic data. This dynamic data is feeded by the user in XHTML format using the FCK editor as the data can be user customised and can have different styles.
Also we have a existing ODT file which we have to use as a template for report.

we have predefined positions in the template ODT where to insert the dynamic data which is in XHTML format.
Can You Please suggest a solution?

Also i have tried with the libraries like ODF - XSLT , POD (Python Open Document ) for using the existing template and inserting the XHTML data, but here also some problem is there as data is inserted but styles from XHTML data are not mapped in the ODT File.

Please suggest a way.
OOo 2.0.X on Ms Windows Other
User avatar
Hagar Delest
Moderator
Posts: 33629
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: XHTML data to embed in Existing ODT file

Post by Hagar Delest »

Please read the Survival Guide for the forum. No multi-posting.

As your last post contain additional details, I've merged it with your initial topic. I won't be of any help now. As this is a rather specific question, please be patient.

I've copied the topic in the external programs forum, perhaps it will have more visibility for the gurus of Python, ...
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE 7 Gigi) and 25.2 portable on Windows 11.
Post Reply