Page 1 of 1

Help with MailMerger

PostPosted: Fri Jan 17, 2020 1:23 am
by ChaFairchild
I created a simple word document using Word for Mac v16.16 and saved it as a docx file. When trying to perform a MailMerge with it, I'm getting a null pointer exception. It seems to be getting into the extractInstr method, and my instructions size seem to be greater then 1. In fact, when I save the docx to XML and unroll it, it seems to be creating these tags.
Code: Select all
                    <w:p w:rsidR="00292328" w:rsidRPr="00031CF5" w:rsidRDefault="00031CF5" w:rsidP="00031CF5">
                        <w:r w:rsidRPr="00031CF5">
                            <w:rPr>
                                <w:lang w:val="en-US"/>
                            </w:rPr>
                            <w:fldChar w:fldCharType="begin"/>
                        </w:r>
                        <w:r>
                            <w:rPr>
                                <w:lang w:val="en-US"/>
                            </w:rPr>
                            <w:instrText xml:space="preserve"> MERGEFIELD </w:instrText>
                        </w:r>
                        <w:r w:rsidR="001126D0">
                            <w:rPr>
                                <w:lang w:val="en-US"/>
                            </w:rPr>
                            <w:instrText xml:space="preserve">\m </w:instrText>
                        </w:r>
                        <w:bookmarkStart w:id="0" w:name="_GoBack"/>
                        <w:bookmarkEnd w:id="0"/>
                        <w:r>
                            <w:rPr>
                                <w:lang w:val="en-US"/>
                            </w:rPr>
                            <w:instrText>caseNumber</w:instrText>
                        </w:r>
                        <w:r w:rsidRPr="00031CF5">
                            <w:rPr>
                                <w:lang w:val="en-US"/>
                            </w:rPr>
                            <w:instrText xml:space="preserve"> \* MERGEFORMAT </w:instrText>
                        </w:r>
                        <w:r w:rsidRPr="00031CF5">
                            <w:rPr>
                                <w:lang w:val="en-US"/>
                            </w:rPr>
                            <w:fldChar w:fldCharType="separate"/>
                        </w:r>
                        <w:r>
                            <w:rPr>
                                <w:noProof/>
                                <w:lang w:val="en-US"/>
                            </w:rPr>
                            <w:t>«caseNumber»</w:t>
                        </w:r>
                        <w:r w:rsidRPr="00031CF5">
                            <w:fldChar w:fldCharType="end"/>
                        </w:r>
                    </w:p>


So my question revolves around these things, does Docx4j support this version of Word, or am I creating the MERGEFIELD wrong in Word for Mac?

Re: Help with MailMerger

PostPosted: Fri Jan 17, 2020 2:21 am
by ChaFairchild
I tried redoing the mail merge labels with a different file, and it seems to work out. I have no idea why word seems to be changing how the mergefield is represented.