PHP 在不丢失样式和图像的情况下将 Word 文件转换为 HTML

2021-12-31 00:00:00 docx ms-word php doc

是否有将word文件转换为HTML而不丢失格式的API?

Is there an API for converting word files to HTML without losing the format?

谷歌文档 API 可以用于此吗?

Can the google documents API be used for this?

我尝试了 saaspose,但返回的结果始终是服务器错误.

I tried saaspose but the returning result is always a server error.

对我不起作用的解决方案:

Solutions that did not work for me:

  • 在 php 中将 MS Word 文档转换为 html

推荐答案

我花了一些时间来研究这个问题,我发现的最佳解决方案是安装 unoconv 在服务器上,并使用 PHP 通过系统调用与其交互.

I've spent a bit of time loking into this, and the best solution that I've found was to install unoconv on the server, and using PHP to interface with it through system calls.

我很想为此找到一个很好的原生 PHP 解决方案,但不幸的是我找不到.

I would have loved to find a good native PHP solution for this, but unfortunately I couldn't.

编辑自从最初回答这个问题以来,我遇到了一个 Web 服务,它提供了一个用于转换文档的 API.我还没有对它进行非常彻底的测试,但它在将 Word 转换为 HTML 时似乎确实产生了不错的结果:CloudConvert.

Edit Since originally answering this, I've come across a web service which presents an API for converting documents. I haven't tested it very thoroughly but it does seem to produce decent results at converting Word to HTML: CloudConvert.

相关文章