Table Rendering problem

We have been seeing a consistent issue in regards how tables are being rendered in Aspose Word (PDF) with ODT documents. In fact it seems to be an issue relating to how styles are managed differently between the two in general. Potentially Character vs Paragraph styles.

I have attached a test document and PDF’s rendered by Openoffice and Aspose. You will see the Aspose one formats over a page and this seems to relate to how paragraph spacing or table spacing is done.

We suspect Aspose is ignoring the character style/formatting and falling back to the styesheet or some other format and therefore adding pararaph spacing when it renders the PDF.

I am wondering if you could shed some light on this for us as it seems to be one the major pitfalls we are hitting when migrating our customers between odt pdf generation in Openoffice vs Aspose.
Aspose Table Formatting (134.1 KB)

Kind Regards

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-24872

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.

You should note that Aspose.Words mimics MS Word upon importing ODT documents. If render your document to PDF using MS Word it also moves part of the table into the next page:
out.pdf (68.2 KB)
ms.pdf (133.6 KB)

Investigation shows that this is caused by different handling of paragraph line spacing. If reset it to singe, the table is rendered closer to Open Office or Libre Office:

Document doc = new Document("C:\\Temp\\in.odt");

Iterable<Paragraph> paragraphs = doc.getChildNodes(NodeType.PARAGRAPH, true);
for (Paragraph p : paragraphs)
    if (p.getParagraphFormat().getLineSpacingRule() == LineSpacingRule.MULTIPLE)

out_preprocessed.pdf (67.6 KB)

Thanks again Alexey,

I am not sure this will work for us as in some cases users have templates that require non single line spacing and this would result in the format being incorrect as well ?

I actually expect that the styles difference between MS Word and ODT (Openoffice) is more pervasive then just line spacing as we are seeing multiple issues relating to how formatting/styles are applied.

Is it possible to provide some more detail of the differences you mention between Word and Openoffice so we can advise customers how to modify their documenst to work as expected and previously ?


@tdekeizer You are right, MS Word and OpenOffice behavior difference is not limited to line spacing. But I am afraid these differences are not documented, so there are no general recommendations how to modify ODT documents in Open Office to make them look as they look in Open Office after rendering the document in MS Word or Aspose.Words. I can only suggest you to open the problematic document in MS Word and see the difference in the document appearance, since Aspose.Words in most cases mimics MS Word behavior when process non-native MS Word formats.

Hi Alexey,
I must admit that is feels wrong that Word ignores the direct formatting set on the text and always uses the style format ? Here is the style on the text:

Here is the default style

The issue with this document is the difference in the below Paragraph spacing (which again makes the document expand to more space then in Open Office), but it can relate to any paragraph formating.

Word supports direct formatting and style formatting. I found this article about the rules that apply to applying formatting in regards paragraphs.
In the test the direct formatting applies to over half (the whole) paragraph so why is the style overriding the direct formatting ?
Also the above applies to applying the formatting not to a document that already has that formatting.
Hopefully you can clarify this for me as I am confused and still think something is not quite right :slight_smile:


@tdekeizer The problem occurs because Open Document and MS Word document formats are quite different. For example let’s consider a paragraph from the original ODT document:

<text:p text:style-name="P35">
	<text:span text:style-name="Default_20_Paragraph_20_Font">
		<text:span text:style-name="T15">Day:</text:span>

Paragraph has P35 style applied:

<style:style style:name="P35" style:family="paragraph" style:parent-style-name="Normal">
	<style:paragraph-properties fo:line-height="150%" fo:text-align="start" style:justify-single-word="false" fo:orphans="0" fo:widows="0" style:text-autospace="none" style:punctuation-wrap="simple"/>

As you can see fo:line-height="150%", line height specified in percepts is converted to LineSpacingRule.Multiple. 150% means line spacing 1.5 lines, what we see in MS Word UI:

Open Office as well as Libre Office also shows this in the UI:

But in Open Office this value is taken in account only when there are more than one line in the paragraph:

While MS Word interprets it differently:

Thanks Alexey for the detailed explanation. very much apprecaited and makes sense.

So the

<text:span text:style-name="Default_20_Paragraph_20_Font">

, which I assume is the direct style on the actual text, is being ignored by MS in this case ?

Can you think of any programatic way to make it behave as per Open Office ?


@tdekeizer Default_20_Paragraph_20_Font definition is in style.xml and look like this:

<style:style style:name="Default_20_Paragraph_20_Font" style:display-name="Default Paragraph Font" style:family="text"/>

So it does not redefine fo:line-height="150%" value specified in P35 style. Also, Default_20_Paragraph_20_Font is applied to text, and line-height (line spacing) is a paragraph’s option, not the text option.
The text formatting is specified using T15 style:

<style:style style:name="T15" style:family="text">
	<style:text-properties style:use-window-font-color="true" fo:font-size="9pt" fo:font-weight="bold" style:letter-kerning="true" style:font-name-asian="SimSun" style:font-size-asian="9pt" style:language-asian="zh" style:country-asian="CN" style:font-weight-asian="bold" style:font-name-complex="Arial" style:font-size-complex="9pt" style:language-complex="hi" style:country-complex="IN" style:font-weight-complex="bold"/>

Unfortunately, the only way to workaround the problem is to reset LineSpacing to single, as I suggested earlier.