Linux 将 HTML 转换为 odt、doc、docx

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8382366/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 03:07:40  来源:igfitidea点击:

Converting HTML to odt, doc, docx

linuxdocumentdocxodt

提问by user1081056

Is there an easy way to convert HTML(with CSS styles and embedded images) to ODT, DOCX, DOC from the command line on linux server. I searched a lot but have not found a good option. There was a problem the same way to convert to PDF, decided by wkhtmltopdf. Perhaps there are ways to convert the resulting PDF documents to other formats?

有没有一种简单的方法可以从 Linux 服务器上的命令行将 HTML(带有 CSS 样式和嵌入图像)转换为 ODT、DOCX、DOC。我搜索了很多,但没有找到一个好的选择。由 wkhtmltopdf 决定的转换为 PDF 的相同方式存在问题。也许有办法将生成的 PDF 文档转换为其他格式?

采纳答案by Zsolt Botykai

To convert to odtit's pretty easy after installing pandoc.

odt安装后转换为它非常容易pandoc

After the relatively hard part: from odt(or even html) you can script (Open|Libre)Office via e.g. unoconv

在相对困难的部分之后:从odt(甚至html)你可以通过例如脚本(Open|Libre)Officeunoconv

Or you can like:

或者你可以喜欢:

abiword --to=doc filename.odt

Also see this thread, and this blog post.

另请参阅此线程此博客文章

HTH

HTH

回答by HansBKK

Post with your issues to the pandoc GoogleGroup, John is very responsive in every way.

将您的问题发布到 pandoc GoogleGroup,John 在各方面都非常敏感。

You may even find the latest release v1.9 may fix your problem, or maybe you just need to get to know the toolset in more detail.

您甚至可能会发现最新版本 v1.9 可能会解决您的问题,或者您可能只需要更详细地了解工具集。

回答by user1081056

I found soultion - is abiword in console variant.

我发现soultion - 是控制台变体中的abiword。

回答by Eduardo Ramos

If you want to convert HTML into docx you may use a solution like PHPDocX. You need to get the PRO version though because the free one does not include the conversion functionality.

如果您想将 HTML 转换为 docx,您可以使用像PHPDocX这样的解决方案。您需要获得 PRO 版本,因为免费版本不包括转换功能。

回答by nicolas

If you're on ruby there is a gem based on libreoffice headless (with pyod/jod converter) and pdf tools

如果您使用 ruby​​,则有一个基于 libreoffice headless(带有 pyod/jod 转换器)和 pdf 工具的 gem

https://github.com/itkin/proselytism.git

https://github.com/itkin/proselytism.git