Categories > [old] TbsOoo & TinyDoc >

Convert html-styles to open office doc.

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Jeroen van Sluijs
Date: 2006-06-15
Time: 14:40

Convert html-styles to open office doc.

Hello,

I use a WYSIWYG editor, which stores the text in html-format.

Is it possible to convert html-styles like <b>bold text</b>, so the 'bold text' will actually be bold in the generated .odt file? I noticed only line-breaks are converted (\n converted to <text:line-break/>).


E.g. template.odt:
Hello, this is my [tag].

The tag is to be replaced by <b>bold text</b>, so the result will be an output_document.odt with the string 'bold text' as bold text.

I've been experimenting with this some time, but I can only manage to find a quite difficult/nasty solution. This would be looking up the bold style in the xml-document (after <office:automatic-styles>) and then inserting <b>bold text</b> in the content.xml as

<text:span text:style-name="T1">bold text</text:span>.

The ugly way would be adding a bold, italic and underlined text at the beginning of the template. In this way, you'll always be sure that bold is mapped to T1, italic->T2 and underlined->T3.

Thanks for any help in advance,
Jeroen
By: Skrol29
Date: 2006-06-16
Time: 10:59

Re: Convert html-styles to open office doc.

Hello,

Why don't you use tbsOOo ? It tunes TBS to deals with Open Office documents.

http://www.tinybutstrong.com/tbsooo.php