How to Convert Word DOC Files to DOCX in JavaScript

Cloudmersive
1 min readApr 6, 2021

--

In order to meet the needs of new software, file formats are constantly being updated or changed. Due to these changes , older documents with outdated formatting may become more difficult to use. This can cause compatibility issues when needing to use, share, or reference these files in modern environments. This API will allow you to automatically convert and upgrade the 1997–2003 Word DOC format to the current DOCX using JavaScript.

To begin, we will install the jQuery library:

bower install jquery

Next, we will call the document conversion function with the following code:

var form = new FormData();
form.append("inputFile", fileInput.files[0], "file");
var settings = {
"url": "https://api.cloudmersive.com/convert/doc/to/docx",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "multipart/form-data",
"Apikey": "YOUR-API-KEY-HERE"
},
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});

By the end of this quick process, your new DOCX file will be available for use! To retrieve your personal API key, head to the Cloudmersive website to register for a free account that will give you access to 800 calls/month across our library of APIs.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet