Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Embedding HTML in DOCX (4.3.1)(<BR> breaks docx, other HTML overflows page width)
Embedding HTML in DOCX (4.3.1) [message #1130300] Wed, 09 October 2013 12:12 Go to next message
Robert Walter is currently offline Robert WalterFriend
Messages: 29
Registered: July 2011
Junior Member
Hi,

in our export, we allow to include textile files via HTML. So far, this worked well with PDF, HTML, and DOC under 4.2.2.

However, with 4.3.1 and the DOCX export, the textile file as well as other HTML-formatted text fields cause trouble.

Here is how we include textile files in a textfield in BIRT designer:
<VALUE-OF format="HTML">
importPackage( Packages.textile.util );
url = params["project"].value + row["name"]
result = Textile.getHTML( url );
</VALUE-OF>

"Textile" is a Java class in the package textile.util and provides the static method getHTML, which returns HTML code as String.
The HTML is rendered in the word file, however, the HTML just exceeds word page width, so images, tables, and text are just not fit into the page width anymore (its just as it is shown when I open the generated HTML file in Word).

Here is the generated HTML code of an example:
<h1 id="Someheader">Some header</h1><p><img style="width:50%" border="0" src="images/title.png"/></p><p class="summary">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p><table style="width:100%; border:thin solid grey"><tr><td><strong>Status</strong>         </td><td>new              </td><td><strong>Initial Version by</strong> </td><td>BLA                           </td></tr><tr><td><strong>Target readers</strong> </td><td>All stakeholders </td><td><strong>Latest edited by</strong>   </td><td>BLA                           </td></tr><tr><td>                </td><td>                </td><td><strong>Next steps</strong>         </td><td>Discuss about BLA, Delete BLA </td></tr></table>

See the attachment illustrating the problem.

Also, when I have a simple text field in my designer with HTML format that contains <BR>, the generated word file won't open.

I tried the DocxOption
docxRenderOption.setOption(DocxRenderOption.OPTION_EMBED_HTML, Boolean.TRUE);


with no effect.

Any suggestions?
  • Attachment: issue.png
    (Size: 131.59KB, Downloaded 253 times)
Re: Embedding HTML in DOCX (4.3.1) [message #1131369 is a reply to message #1130300] Thu, 10 October 2013 13:09 Go to previous message
Robert Walter is currently offline Robert WalterFriend
Messages: 29
Registered: July 2011
Junior Member
Okay, I figured that Word for some reasons ignores CSS styles. With some help I found out that I have to set the option from above to FALSE!

docxRenderOption.setOption(DocxRenderOption.OPTION_EMBED_HTML, Boolean.FALSE);


This assigns Birt to not put the HTML in the docx file but to convert it to Birt objects. Nice to know.
However, I wouldn't label the generated Birt content as "correct", since it does not translate HTML paragraphs in a way that contains line breaks.

I looked into the HTML2Content and Tag2Style classes and it seems like the <p> tag is handled with the CSS_BLOCK style. Is this correct or is the newline missing I would expect after a <p>...</p> construct in HTML?

[Updated on: Thu, 10 October 2013 13:42]

Report message to a moderator

Previous Topic:Tables with merged cells are not correctly rendered
Next Topic:EngineException Error
Goto Forum:
  


Current Time: Sun Sep 19 21:14:56 GMT 2021

Powered by FUDForum. Page generated in 0.01302 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top