This article guides on how to remove bookmark in Word with NET REST API. You will learn to automatically remove bookmark in Word with C# REST API using the .NET cloud SDK. You can iterate this process to remove all the bookmarks from a Word file.
Prerequisite
- Create an account and get API credentials
- Download Aspose.Words Cloud SDK for Dotnet to remove a bookmark in a Word file
- Setup C# solution project with the above SDK for deleting bookmarks
Steps to Delete Bookmark in Word with C# REST API
- Instantiate the Configuration object by setting the ClientId and ClientSecret
- Create the WordsApi object using the given configuration
- Read the input Word file into the byte array
- Instantiate the DeleteBookmarkOnlineRequest request object by providing the bookmark name
- Invoke the DeleteBookmarkOnline method to remove the bookmarks
- Save the resultant Word file after deleting the specified bookmark
The above steps summarize how to delete a bookmark in Word with C# Low Code API. Instantiate the WordsApi object and read the input Word file into the byte array. Create the DeleteBookmarkOnlineRequest object and set the bookmark name that you want to delete from the Word file followed by calling the DeleteBookmarkOnline() method to delete the bookmark.
Code to Delete Bookmark in Word with C# Low Code API
This sample code exhibits how to delete a bookmark in Word with NET REST API. Note that if you do not provide a target bookmark name while initializing the DeleteBookmarkOnlineRequest object and do not provide this argument, it will delete all the bookmarks from the loaded Word file.
This article has taught us the process of removing a particular bookmark from a Word file. If you are interested in adding a bookmark, refer to the following article: Add Bookmark in Word with NET REST API.