Weird docx4j/word behaviour
Posted: Thu May 29, 2014 2:47 am
I'm currently reviewing my "mail merge" program which gives me a NPE in getDatafieldNameFromInstr with some docx files.
Which is weird is that some problematic mergefields are wrapped in XML.
E.g. the displayed field name (in Word) is "ih16_nummerierung_stromkreis:aufgabe_dringlichkeit" where the xml content displays
<w:r>
<w:instrText xml:space="preserve"> MERGEFIELD ih1</w:instrText>
</w:r>
<w:r>
<w:instrText xml:space="preserve">6_nummerierung_stromkreis:aufgabe_dringlichkeit \* MERGEFORMAT </w:instrText>
</w:r>
This seems to puzzle docx4j and I wonder how to fix this problem?
Are there any switches in Word or docx4j which will change the default behavior?
Which is weird is that some problematic mergefields are wrapped in XML.
E.g. the displayed field name (in Word) is "ih16_nummerierung_stromkreis:aufgabe_dringlichkeit" where the xml content displays
<w:r>
<w:instrText xml:space="preserve"> MERGEFIELD ih1</w:instrText>
</w:r>
<w:r>
<w:instrText xml:space="preserve">6_nummerierung_stromkreis:aufgabe_dringlichkeit \* MERGEFORMAT </w:instrText>
</w:r>
This seems to puzzle docx4j and I wonder how to fix this problem?
Are there any switches in Word or docx4j which will change the default behavior?