Thank you for the reply!
I don’t see any changes in the 18.12.docx document. I ran the code you suggested on my file and nothing changed in the footer. However, when I just ran this section of your code:
Bookmark bm = doc.Range.Bookmarks["TOTPAGES"];
bm.Text = string.Empty;
bm.Remove();
The red {NUMPAGES} was removed instead of the TotPages bookmark. This ended up setting the bookmark to !Undefined Bookmark, TOTPAGES instead of removing it completely. I have attached a file showing this named RemoveBookmarkOnly.rtf
I also just ran the InsertField portion of your code:
builder.MoveToBookmark("TOTPAGES", false, true);
builder.Font.Color = Color.Blue;
builder.InsertField(FieldType.FieldNumPages, true);
and it ended up inserting another {NUMPAGES} to the right of the red {NUMPAGES} instead of next to the TotPages bookmark. I attached a file showing this named InsertFieldOnly.rtf
Insert Field and Remove Bookmark Docs.zip (18.7 KB)