是否可以使用jquery/javascript将doc/docx转换为html? [英] Is it possible to convert doc/docx to html using jquery/javascript?
问题描述
我需要将doc/docx转换为html.我有存储在Amazon s3中的文件.我需要查看&在浏览器中对其进行编辑.现在,我正在使用Apache POI将doc/docx转换为html.我在HTML编辑器(jQuery插件)上显示响应.它可以工作,但是对齐方式/格式会更改.也无法提取图像.修复图像提取和解析的任何解决方案格式问题,请参考或参考任何Jquery/JS插件进行转换.
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.
推荐答案
在快速Google搜索中,我发现了以下库:(我没有使用过,也未认可其中的任何一个)
Doing a quick Google Search, I found these libraries: (I have not used, nor endorsed any of these)
- docx2html
- mammoth
docx2html基本功能:
docx2html basic functionality:
var docx2html=require('docx2html')
docx2html(fileInput.files[0],{container:document.getElementById('a')}).then(function(html){
html.toString()
})
强大的基本功能:
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();
我希望这至少是有用的
这篇关于是否可以使用jquery/javascript将doc/docx转换为html?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!