Har*_*ari 4 javascript jquery amazon-s3 apache-poi
我需要将 doc/docx 转换为 html。我有文件存储在 Amazon s3 中。我需要在浏览器中查看和编辑它。现在,我正在使用 Apache POI 将 doc/docx 转换为 html。我在 HTML 编辑器(Jquery 插件)上显示响应。它有效,但对齐/格式发生变化。也没有提取图像。任何修复图像提取和格式问题的解决方案,请参考或参考任何 Jquery/JS 插件进行转换。
做一个快速的谷歌搜索,我找到了这些库:(我没有使用过,也没有认可其中的任何一个)
docx2html 基本功能:
var docx2html=require('docx2html')
docx2html(fileInput.files[0],{container:document.getElementById('a')}).then(function(html){
html.toString()
})
Run Code Online (Sandbox Code Playgroud)
庞大的基本功能:
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();
Run Code Online (Sandbox Code Playgroud)
我希望这至少是有用的