Hi,
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| “,”");
db.getDocument().save(…);
Attaching the generated document for your reference. Please suggest a way to avoid the auto-updation (or whatever issue is causing this behaviour). Thanks.
Hi Praneeth,
Best regards,
Hi Praneeth,
Thanks for being patint. Regarding WORDSNET-10433, our development team has completed the work on your issue and has come to a conclusion that this issue and the undesired behaviour you’re observing is actually not a bug. So, we have closed this issue as ‘Not a Bug’.
Aspose.Words doesn’t update fields in header/footer while saving to docx, MS Word automatically updates them when opening the document. You should avoid using formula field for custom purpose. However, MS Word and Aspose.Words have different error text for formula field with following code:
MS Word: !Syntax Error, |
Aspose.Words: !Undefined Bookmark, HSCOMMENT|BEGIN|111111|
If we can help you with anything else, please feel free to ask.
Best regards,