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

# Updating only parts of the Comments fields, after changing the values

Good day,
I change the value of the field in the document, update all fields of type Comments. However, the new value is written to me only in part of the fields. Could you take a look at why it doesn’t prescribe it for everyone but only for some…

my code:

Document doct = new Document("..................................");

for (int idx = doct.Range.Fields.Count - 1; idx >= 0; idx--)
{
Field field = doct.Range.Fields[idx];
{
field.Update();
}
}


the result is that out of 126 fields, the value changes in 55…

P099_3M.docx (613.9 KB)

the document is divided into sections, each header has a field

@benestom Thank you for addition information. In your document there are COMMETS fields that replaces the value set in the doc.BuiltInDocumentProperties.Comments:
{ COMMENTS 6.2.3.1 } and { COMMENTS 6.2.3.2 }

So upon updating these fields, the value in the doc.BuiltInDocumentProperties.Comments is overridden. Please see the following link for more information:

You can reset new comment text in the COMMETS to avoid this:

Document doc = new Document(@"C:\Temp\in.docx");