Free Support Forum -

Remove all Bookmarks

After I finish building my document, I'd like to remove all the bookmarks. How do I go about doing that?

It can be done using Document.Range.Bookmarks collection:

ArrayList bookmarks = new ArrayList();

foreach (Bookmark bookmark in doc.Range.Bookmarks)




foreach (Bookmark bookmark in bookmarks)




Range.Bookmarks.Clear() and Range.FormFields.Clear() methods were added in Aspose.Words 4.0 to simplify clearing bookmarks and formfields from the specified range.