We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Editing text within an IF statement

We have a document created through Aspose and if the user edits text that is displayed based on an IF statement condition, the text displayed is still the original (even though when I ALT+F9 the document, the IF statement shows the revised text)
The original IF statement was {IF U = “IR” “PS” “NI”} - when I amend it to {IF U = “IR” “PS” “NIxxx”} the document still displays “NI”
Any help gratefully received
Many thanks

Hi Mike,

Thanks for your inquiry. Please call Document.UpdateFields method before saving the final document. When you open, modify and then save a document, Aspose.Words does not update fields automatically, it keeps them intact. Therefore, you would usually want to call this method before saving if you have modified the document programmatically and want to make sure the proper (calculated) field values appear in the saved document.

If you still face problem, please share following detail for investigation purposes.

  • Please attach your input Word document.

  • 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

  • Please attach the output Word file that shows the undesired behavior.

  • Please attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. I will investigate as to how you are expecting your final document be generated like.

Thanks Tahir
That was really helpful and has worked. Updating the fields amended the edited text. Really appreciate it

Hi Mike,

for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.