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

Free Support Forum - aspose.com

Updating fields within a nested IF statement

I recently posted this question regarding the update of text within IF statements
I have found that if you have the document NOT showing the fields, delete some text from within the nested IF and then do CTRL+A then F9, the deleted text reappears. If you perform the same operation on the document when the fields are being displayed, the deleted text stayes deleted.
Is this a bug or is there something else I am doing wrong?
I’m attaching a sample document. If you attempt to delete the paragraph starting “2.2 If you have paid…” with the fields OFF, it reappears
Many thanks

Hi Mike,

for your inquiry. In case you are using an older version of Aspose.Words, I would suggest you please upgrade to the latest version (v14.8.0) from here and let us know how it goes on your side.

I have tested the scenario using following code example and have not found the shared issue.

Document doc = new Document(MyDir + "Temp25092014.doc");
foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))
    if (para.ToString(SaveFormat.Text).Contains("2.2 If you have paid"))
doc.Save(MyDir + "Out.docx");

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 and share it here for testing purposes.


For what it’s worth, I have noticed from time to time that certain Word document XML becomes corrupted and causes behavior like this. I think it happens when saving from the MS Word editor. I have no explanation for it, but I have noticed the issue resolves when you move all your text to a new document and save the new document. I have noticed it occurring with small phrases as well as some text formatting, like underlining.

I have also noticed odd behavior if you nest IF fields too deeply. { IF this "{ IF that "{ IF theOther "my Text" }"}"}

Once you are nested 3 deep, Word can become buggy. This has forced me to find other ways in order to avoid nesting, like this. {IF ={{ IF this 1 0} + { IF that 1 0} + { IF theOther 1 0}} = 3 "myText"}

Neither of these have been Aspose problems.

Hi Mike,

for your feedback. Please let us know if you face any issue while using Aspose.Words, we will be happy to help you.