Page 1 of 1

Splitting tables using docx4j

PostPosted: Fri Dec 06, 2013 6:40 pm
by bhaskar256
Hi Jason,

We are using docx4j to replace some tags in a docx file with tables. When the number of rows don't fit into one page, we are having the table Header column repeating at the top of each page.

However we have a requirement to Split the table into two separate tables whenever the table goes into a new page and put some text at the top. Something like Table ABC (continued). I can see this is not a table property in MS Word but a separate action performed from the Layout tab.

Is it possible to achieve this using docx4j?

Thanks in advance.

Re: Splitting tables using docx4j

PostPosted: Fri Dec 06, 2013 7:59 pm
by jason
bhaskar256 wrote:Is it possible to achieve this using docx4j?


In principle, yes. In practice, you'll have 2 issues.

Issue 1: take vertically merged cells into account, if splitting on a row affected by them

Issue 2: how to determine when the table spills onto a new page? For this, you need to know where the pages start and end, and for that, you need a page layout model, and presumably one which mimics Word's (unless you only care about PDF output?). docx4j doesn't have a page layout model.

Re: Splitting tables using docx4j

PostPosted: Mon Dec 09, 2013 9:02 pm
by bhaskar256
Hi,

Thanks for the prompt reply.

I can see doc4j works basically with the xml representation of the Word document and has no control over such actions.

But are you aware any API I can try to achieve this?

Thanks in advance.