Page 1 of 1

Repeat section duplicate first row when exporting to pdf

PostPosted: Mon Jan 23, 2012 9:28 am
by ttran
Hi all,

Could you kindly help me with this situation? When processing a word template with OpenDoPE repeats, docx4j generates output as expected in Docx. However, when exporting to pdf (using viaXSLFO), all data in the table are just duplicates of the first row. Please note that number of rows are populated correctly.

Please see the attached outputs:
output_1.docx
Correct docx output
(24.98 KiB) Downloaded 372 times

output_1.pdf
Duplicate rows pdf output
(26.95 KiB) Downloaded 400 times


Thanks,
Tien

Re: Repeat section duplicate first row when exporting to pdf

PostPosted: Mon Jan 23, 2012 11:42 am
by jason
The export to PDF functionality doesn't automatically perform OpenDoPE processing.

You need to take the OpenDoPE output, and run that through PDF export.

I'm not sure exactly what you are doing, and how you end up with duplicates of the first row. But it sounds very much like you are doing

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
                OpenDoPEHandler odh = new OpenDoPEHandler(wordMLPackage);
                odh.preprocess();
 
Parsed in 0.014 seconds, using GeSHi 1.0.8.4


(which will give you the appearance of duplicate rows - the XPaths bindings will actually be different) without then doing

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
                BindingHandler.applyBindings(wordMLPackage.getMainDocumentPart());

 
Parsed in 0.013 seconds, using GeSHi 1.0.8.4


(which is what gets the correct content using the XPath bindings).

Please see the ContentControlBindingExtensions sample for a complete example.

Re: Repeat section duplicate first row when exporting to pdf

PostPosted: Mon Jan 23, 2012 6:01 pm
by ttran
Thanks for your response,

After adding pdf export part into ContentControlBindingExtensions and it works, I reckon something was wrong in my code. Then found out that I called openDoPEHandler.process() before updating the xml part.

It was such a relief.

Many thanks,
Tien