Page 1 of 1

Docx4j API after performing mail merge giving alert

PostPosted: Wed Mar 21, 2018 7:48 pm
by rohit.prajapati
While we perform mail merge through Docx4j API , we got the output in a docx file but when we open it in Microsoft Word 2010 an alert message appear:

Image

TestDoc1.dotx
Sample File
(16.45 KiB) Downloaded 208 times


TestDoc1.docx
Output File
(13.07 KiB) Downloaded 236 times

Re: Docx4j API after performing mail merge giving alert

PostPosted: Thu Mar 22, 2018 8:08 pm
by jason
The first table cell in your output docx is:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
                <w:tc>
                    <w:tcPr>
                        <w:tcW w:w="9242" w:type="dxa"/>
                    </w:tcPr>
                </w:tc>
 
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


As per the error message, you must have a w:p in there.

Looking at your input document, the entire paragraph that was there is gone.

Can you post a working example of your relevant code?

Re: Docx4j API after performing mail merge giving alert

PostPosted: Fri Mar 23, 2018 2:48 am
by rohit.prajapati
Hi Jason,

I have attached the code which I am using to process mail merge.

FieldsMailMerge.java
Mail Merge Code
(3.8 KiB) Downloaded 249 times


jason wrote:The first table cell in your output docx is:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
                <w:tc>
                    <w:tcPr>
                        <w:tcW w:w="9242" w:type="dxa"/>
                    </w:tcPr>
                </w:tc>
 
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


As per the error message, you must have a w:p in there.

Looking at your input document, the entire paragraph that was there is gone.

Can you post a working example of your relevant code?

Re: Docx4j API after performing mail merge giving alert

PostPosted: Mon Mar 26, 2018 8:47 pm
by jason
See now https://github.com/plutext/docx4j/commi ... 30428bb9e8

It will be in a nightly build soon.

Or you can use something other than OutputField.REMOVED, for example: org.docx4j.model.fields.merge.MailMerger.setMERGEFIELDInOutput(OutputField.DEFAULT);