是否可以使用jquery / javascript将doc / docx转换为html?

我需要将doc / docx转换为html。 我有存储在amazon s3中的文件。 我需要在浏览器中查看和编辑它。 现在,我正在使用Apache POI将doc / docx转换为html。 我正在HTML编辑器(Jquery插件)上显示响应。 它工作但对齐/格式更改。 也是未提取的图像。 任何修复图像提取和格式化问题的解决方案,请参考或引用任何Jquery / JS插件进行转换。

快速进行谷歌搜索,我找到了这些库:(我没有使用过,也没有认可过这些库)

  • docx2html
  • 长毛象

docx2html基本function:

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

庞大的基本function:

 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(); 

我希望这至少是有用的