different BlockBox output with the same input string
Posted: Wed Apr 09, 2014 12:20 am
Hi,
I experience the following effect. I generate a Word document from an XHTML source. Using the same source string, one of my Java applications processes the content correctly and generates a nice Word document. My RCP application which processes exactly the same source string generates a different Word document where all formats are gone. I use the same code to generate the Word document in both applications:
After a long session of debugging, I have found out that the root cause of this problem is the BlockBox being returned from
in class XHTMLImporterImpl.java on line 659 (traverse(renderer.getRootBox(), null);).
In the simple example of "<body></body>";, the BlockBox returned by renderer.getRootBox(); is filled with
in the Java application which generates the nice looking and well formated Word document. During the run of the RCP application, the following value is generated by renderer.getRootBox();:
How is this possible? I really use the same code in both applications.
I truly hope, that someone can help me out on that or at least point me into the right direction...
Best regards and thank you very much in advance!
I experience the following effect. I generate a Word document from an XHTML source. Using the same source string, one of my Java applications processes the content correctly and generates a nice Word document. My RCP application which processes exactly the same source string generates a different Word document where all formats are gone. I use the same code to generate the Word document in both applications:
- Code: Select all
this.wordMLPackage = WordprocessingMLPackage.load(new File(TEMPLATE_WORD_DOCUMENT));
String htmlString = "<body></body>";
XHTMLImporterImpl xHTMLImporter = new XHTMLImporterImpl(this.wordMLPackage);
xHTMLImporter.setParagraphFormatting(FormattingOption.CLASS_TO_STYLE_ONLY);
xHTMLImporter.setRunFormatting(FormattingOption.CLASS_PLUS_OTHER);
this.wordMLPackage.getMainDocumentPart().getContent().addAll(xHTMLImporter.convert(htmlString, ""));
After a long session of debugging, I have found out that the root cause of this problem is the BlockBox being returned from
- Code: Select all
renderer.getRootBox();
in class XHTMLImporterImpl.java on line 659 (traverse(renderer.getRootBox(), null);).
In the simple example of "<body></body>";, the BlockBox returned by renderer.getRootBox(); is filled with
- Code: Select all
BlockBox: <body> (block) (B) (0,0)->(13954 x 320))
in the Java application which generates the nice looking and well formated Word document. During the run of the RCP application, the following value is generated by renderer.getRootBox();:
- Code: Select all
BlockBox: <body> (inline) (B) (0,0)->(15874 x 0)
How is this possible? I really use the same code in both applications.
I truly hope, that someone can help me out on that or at least point me into the right direction...
Best regards and thank you very much in advance!