| layout | post |
|---|---|
| title | Bookmarks in Blazor DOCX Editor Component | Syncfusion |
| description | Learn how to add, navigate, and manage bookmarks in the Syncfusion Blazor Document Editor component both through the UI and programmatically. |
| platform | document-processing |
| control | Document Editor |
| documentation | ug |
A bookmark marks a specific place in a document so you can easily find it again. You can insert multiple bookmarks in a document and give each one a unique name for easy identification.
The Blazor Document Editor (Document Editor) provides two ways to manage bookmarks: through a built-in dialog or programmatically using API methods. Once a bookmark is added, you can jump to its location or create hyperlinks to it.
N> Bookmark names need to begin with a letter. They can include letters and numbers, but not spaces. To separate words in a name, use an underscore. Bookmark names starting with an underscore are called hidden bookmarks. For example, bookmarks generated for the table of contents.
Open the bookmark dialog using the Bookmark option in the toolbar. For more details on bookmark functionality, refer to the Blazor Word Processor - Bookmark example.
Use the InsertBookmarkAsync method to add a bookmark to the currently selected text.
await container.DocumentEditor.Editor.InsertBookmarkAsync("Bookmark1");Use the SelectBookmarkAsync method to navigate to and select a bookmark by its name.
await container.DocumentEditor.Selection.SelectBookmarkAsync("Bookmark1");Use the DeleteBookmarkAsync method to delete a bookmark by its name.
await container.DocumentEditor.Editor.DeleteBookmarkAsync("Bookmark1");Use the GetBookmarksAsync method to retrieve a list of all bookmarks in the document.
// Get all bookmarks, including hidden ones.
await container.DocumentEditor.Selection.GetBookmarksAsync(true);N> The boolean parameter of GetBookmarksAsync specifies whether to include hidden bookmarks in the result. If false, hidden bookmarks are excluded.
Explore how to insert and manage bookmarks in Word documents using the Blazor Document Editor in this live demo.