I'm using Mammothjs to convert docx file to html in ReactJs and it works perfectly. However, it's currently not supporting doc files. Is there any way or any alternative to convert doc files to HTML? TIA
Asked
Active
Viewed 433 times
1 Answers
0
var mammoth = require("mammoth");
mammoth.convertToHtml({path: "document.docx"})
.then(function(result){
var html = result.value; // The generated HTML
var messages = result.messages; // Any messages, such as warnings during conversion
console.log(html);
})
.done();
In the above code, you simply replace "document.docx" with the path of your .doc file, and Mammoth.js will generate the HTML for you. You can then use this HTML as needed in your web application.

Harsh Mangalam
- 1,116
- 1
- 10
- 19