Page 1 of 1

How to remove the whitespace between tables?

PostPosted: Sat Feb 13, 2016 4:24 am
by Zezombye
So, I have a word document containing only 4 tables. However if I put the tables one after the other, there is no space between them. But if I put a paragraph between them, there are 2 spaces between them, when I only want one.

Here's a screenshot of how it looks:

Image

Here's how it should look:

Image

How do I achieve this whitespace between tables?

Also, how do I change the font size of the document? Tried editing the docDefaults but it doesn't work (the w:sz and w:szCs say size 24 when it's actually size 11, and I want size 12, changing w:sz and w:szCs to 12 does nothing)

Re: How to remove the whitespace between tables?

PostPosted: Mon Feb 15, 2016 6:06 pm
by Zezombye
Solved the problem, it was just that for some reason changing the style in my code did nothing. To change the style, I went to the styles.xml in src/main/java -> org.docx4j.openpackaging.parts.WordProcessingML and then, in the docDefaults, changed the font and the size (put twice the size, in this example I put 24 because I wanted size 12).

As for the whitespace between tables it was the stupid Word defaults with the linespace between each paragraph, to remove that go in the docDefaults, then in the pPrDefault, then pPr, then spacing. You should have 3 attributes : w:after, w:line and w:linerule. Remove the w:after attribute and the problem is solved. There's still the problem of the line spacing being set to 1.15% so the fix is to change the value of the w:line attribute from 276 to 240. lineRule should be set to auto.

Re: How to remove the whitespace between tables?

PostPosted: Sat Mar 12, 2016 7:23 am
by metj01
Hi,

I'm having similar problems when merging docx documents, the linespace is changed from 1 to 1.08. How did you override the styles.xml as it is contained in the Dox4j jar?

Thank you

Joseph