This article demonstrates how to Java REST API remove a bookmark from a Word (DOCX) document using the Aspose.Words Cloud SDK; you can also learn how to delete all bookmarks from a file if needed. For more information about the DOCX format, visit the DOCX file info page.
Prerequisite
- Create an account and get API credentials
- Download the Aspose.Words Cloud SDK for Java to remove a bookmark in a Word file
- Set up a Java project with the above SDK for deleting bookmarks
Steps to Delete Bookmark in Word with Java REST API
- Instantiate the
Configurationobject by setting theClientIdandClientSecret. - Create the WordsApi object using the given configuration.
- Read the input Word file into a byte array.
- Instantiate the DeleteBookmarkOnlineRequest object by providing the bookmark name.
- Invoke the DeleteBookmarkOnline method to remove the bookmark.
- Save the resultant Word file after deleting the specified bookmark.
The steps above summarize how to delete a bookmark in Word with the Java REST API. First, create the WordsApi instance and load the Word file into a byte array. Then, build a DeleteBookmarkOnlineRequest with the name of the bookmark you want to remove and call DeleteBookmarkOnline() to perform the deletion.
Code to Delete Bookmark in Word with Java REST API
This sample code shows how to delete a bookmark in Word using the Java REST API. If you omit the bookmark name when creating the DeleteBookmarkOnlineRequest, the API will delete all bookmarks from the loaded document.
If you want to add a bookmark instead, see the article: Add Bookmark in Word with Java REST API.
Keywords: how to delete a bookmark in word with Java Low Code API; remove bookmark in word with NET REST API; how to delete a bookmark in word with NET REST API; delete bookmark in word with Java Low Code API; remove bookmark in word with Java REST API.