Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
45
rated 0 times [  51] [ 6]  / answers: 1 / hits: 20374  / 8 Years ago, tue, december 13, 2016, 12:00:00

I need to convert doc/docx to html. I have files stored in Amazon s3. I need to view & edit it in browser. Right now, I am using Apache POI to convert doc/docx to html. And I am displaying the response on HTML editor(Jquery Plugin). It works but alignment/format changes. Also images not extracted. Any solution to fix image extraction & formatting issues, please refer or refer any Jquery/JS plugin for conversion.


More From » jquery

 Answers
62

Doing a quick Google Search, I found these libraries: (I have not used, nor endorsed any of these)





docx2html basic functionality:



var docx2html=require('docx2html')
docx2html(fileInput.files[0],{container:document.getElementById('a')}).then(function(html){
html.toString()
})


mammoth basic functionality:



var mammoth = require(mammoth);


mammoth.convertToHtml({path: path/to/document.docx})
.then(function(result){
var html = result.value; // The generated HTML
var messages = result.messages; // Any messages, such as warnings during conversion
})
.done();


I hope this was, at least, useful


[#59721] Sunday, December 11, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
michelecarissab

Total Points: 730
Total Questions: 97
Total Answers: 110

Location: Uzbekistan
Member since Sat, Feb 27, 2021
3 Years ago
;