If I write in document’s template fields “PAGE” or “NUMPAGES”, then method MailMerge returns exception “Object reference not set to an instance of an object.”.
Document = new Document(stream);
Document.MailMerge.Execute(new RegionsMailMergeDataSource(DataSource, null));
The source of the problem is the flag RemoveUnusedFields. If I delete the flag
RemoveUnusedFields, then method MailMerge works normal.
How can I solve the problem?
This problem is heisenbug. I have attached a document template that should help to reproduce this bug.
Thanks for your inquiry. It would be great if you please create a standalone/runnable simple application (for example a Console Application Project) that demonstrates the code (Aspose.Words code) you used to generate your output document.
I have attached a test project.
P.S. Licence is deleted to project
<div id="dstTextBox" tabindex="0" class="yt-area-textbox yt-area-textbox__textbox">Thank you, we will wait for the decision.</div>
<div id="dstTextBox" tabindex="0" class="yt-area-textbox yt-area-textbox__textbox">Good afternoon.<br>What is the status of the problem solving?</div>