Page 1 of 1

Multiple pages

PostPosted: Wed Apr 09, 2014 2:46 am
by leggendario
Good evening to all.
I'm using docx4j to generate and then print membership cards of my association. I thought I would use a template file with placeholders to be replaced with the member information (first name, last name, etc..).
If I have to print a single card there is no problem, everything is in position.
But if I have many I would create a page for each membership card.
I need to replicate the same page from the template.
If I try to replicate, using a cycle, everything is in the tag <wx:sect> the following pages do not have the details of spacing and printing is not aligned properly.

Is there a way to create a new page in the same document, always using the template?
Otherwise, what solutions do I have? Crare a template of 200 pages and, once made ​​the substitutions, eliminate those that do not I need? Does it makes any sense?

Or Is there a way to set text in an exact position? So I could drop the idea of using a template and generate my doc on the fly
Sorry for my bad Englsh.
Thank you in advance.

Re: Multiple pages

PostPosted: Wed Apr 09, 2014 2:47 pm
by jason
When I created a test page of labels in Word, it generated a table, filling a page.

leggendario wrote:Is there a way to create a new page in the same document, always using the template?


So yes I'd suggest you treat that table as your unit of content. You just need to insert it, followed by a page break. You can upload a sample docx to the webapp to generate code to use as a starting point.

If you wanted to, you could factor out the code to create a single row. You'd need to keep count of how many rows you've added, so you know when to start a new page.

Or you could just leave the new page stuff to Word - the table is set up to flow across pages.

The above assumes you'll write a method which injects your data.

An alternative would be to keep your data in an XML file, and use content control data binding. You'd have a single table row with an OpenDoPE repeat wrapped around it.

leggendario wrote:everything is in the tag <wx:sect>


Please note that wx:sect is legacy 2003 XML, not part of OpenXML, and not supported by docx4j.