Removing an Object from a Word Document in Java

In previous posts, we shared how to use the Begin Editing and Finish Editing functions to open and close an online document. Today, we will share how to remove an object from a document you opened for modification; this applies to paragraphs, tables, images, etc. Before we dig into the process, be sure you have the object path handy to plug into the request configuration.

Image for post
Image for post

To kick things off, install the Maven SDK by adding a reference to the repository in pom.xml:


Then, add a reference to the dependency:


Now we are ready to call the remove object function with the following code:

// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.EditDocumentApi;

To close out editing of your document, be sure to leverage our Finish Editing API (see previous post) to download and save your changes.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store