officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-bookmarkcollection-dot-remove-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-bookmark-x29.md
Removes the specified bookmark from the collection.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
void Remove(
Bookmark bookmark
)
Sub Remove(
bookmark As Bookmark
)
| Name | Type | Description |
|---|---|---|
| bookmark | Bookmark |
A Bookmark object specifying a bookmark in the document.
|
The code sample below shows how to locate and remove bookmarks in the 6th paragraph:
using DevExpress.XtraRichEdit.API.Native;
using (var wordProcessor = new RichEditDocumentServer())
{
wordProcessor.LoadDocument("Documents//Document.docx");
Document document = wordProcessor.Document;
var bookmarks =
document.Bookmarks.Get(document.Paragraphs[5].Range);
if (bookmarks != null)
{
foreach (Bookmark bookmark in bookmarks)
{
document.Bookmarks.Remove(bookmark);
}
}
}
Imports DevExpress.XtraRichEdit.API.Native
Using wordProcessor As New RichEditDocumentServer()
Dim document As Document = wordProcessor.Document
Dim bookmarks = document.Bookmarks.Get(document.Paragraphs(5).Range)
If bookmarks IsNot Nothing Then
For Each bookmark As Bookmark In bookmarks
document.Bookmarks.Remove(bookmark)
Next bookmark
End If
End Using
The following code snippets (auto-collected from DevExpress Examples) contain references to the Remove(Bookmark) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-richedit-iterate-through-all-sub-documents/CS/Form1.cs#L31
for (int i = subdoc.Bookmarks.Count - 1; i >= 0; i--)
subdoc.Bookmarks.Remove(subdoc.Bookmarks[i]);
}));
word-document-api-iterate-through-all-sub-documents/CS/Program.cs#L45
for (int i = subdoc.Bookmarks.Count - 1; i >= 0; i--)
subdoc.Bookmarks.Remove(subdoc.Bookmarks[i]);
}));
winforms-richedit-iterate-through-all-sub-documents/VB/Form1.vb#L22
For i As Integer = subdoc.Bookmarks.Count - 1 To 0 Step -1
subdoc.Bookmarks.Remove(subdoc.Bookmarks(i))
Next
word-document-api-iterate-through-all-sub-documents/VB/Program.vb#L40
For i As Integer = subdoc.Bookmarks.Count - 1 To 0 Step -1
subdoc.Bookmarks.Remove(subdoc.Bookmarks(i))
Next
See Also