是否可以使用 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 基本功能:
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屋!