Delete an Object from an Online DocX Document in Node.JS

Have you ever edited a Word document online and realized you need to remove an object (paragraph, table, image, etc.)? If so, you know that it can be a tedious task to attempt manually. By using our Remove Object function, you’ll save significant time in your overall process. This function can be used after our Begin Editing function, which opens up the document for editing.

Image for post
Image for post

Start the Remove Object function by running this command to install the SDK:

npm install cloudmersive-convert-api-client –save

Or, you can add this snippet to your package.json:

  "dependencies": {
"cloudmersive-convert-api-client": "^2.4.8"
}

Next, you can call the function — be sure to have the path of your target object ready for this step. If you don’t have the path, you can obtain it using our Get-Image, Get-Paragraph, Get-Body, etc. APIs.

var CloudmersiveConvertApiClient = require('cloudmersive-convert-api-client');
var defaultClient = CloudmersiveConvertApiClient.ApiClient.instance;

The returned result will show that the object has been successfully removed from your Word document. To download and save your updates, simply close out the operation with our Finish Editing function.

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