Hello,
I have a complex code with a complex template that in some conditions throws a NullReferenceException exception when saving as PDF.
It required me a lot of time to understand what caused this exception in my code because it did not happen always, but at the end I found a way to reproduce the bug in an easy way.
All these conditions must be met to see the bug:
- the document must have a page number field
- the method Document.UpdateFields() must be called before editing the document
- the document must be edited
- the method Document.UpdateFields() must NOT be called after editing the document
- the document must be saved as PDF
If also only one of the condtions is changed, the exception is not thrown.
Note:
I’m not blocked by this bug because I do not need to call Document.UpdateFields() in my real case (it was an error in my code to do so), anyway I wanted to notify this to you as this could potentially happen in other contexts.
Tested with Aspose.Words 20.3 and Word 2013.
Attached you can find an example document with C# code.
Bug Dynamic Columns with UpdateFields.zip (14.1 KB)