There seems to be any issue with the insertion of custom formula fields as part of the header/footer. The fields are getting inserted properly, but then, they also seem to get updated automatically if they’re part of the header/footer, unlike the fields in the body, and are displaying syntax error. I’ve been utilizing this chunk of code to insert the field in the header/footer.
DocumentBuilder db = new DocumentBuilder(doc); db.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY); db.insertField(" = HsComment|begin|111111| “,”"); db.moveToHeaderFooter(HeaderFooterType.FOOTER_PRIMARY); db.insertField(" = HsComment|end|111111| “,”");
Attaching the generated document for your reference. Please suggest a way to avoid the auto-updation (or whatever issue is causing this behaviour). Thanks.