如何将HTML转换为Microsoft Word文档? [英] How to convert HTML to a Microsoft Word document ?

查看:166
本文介绍了如何将HTML转换为Microsoft Word文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将HTML编辑器中的HTML转换为Microsoft Word文档?

解决方案

我用api docx4j-ImportXHTML 编写了一个java方法来实现它。

这个想法是创建一个方法,该方法需要保存新文件的xhtml,结果文件名和路径。该文件将处理xhtml,并将其保存为提供的文件名和给定目的地的文件。检查
完整代码链接获取完整代码。



添加依赖关系docx4j-ImportXHTML,使用(3.3.1是我写这个答案时的最新版本,如果你以后看到它使用最新的稳定版本)。

 <依赖性> 
< groupId> org.docx4j< / groupId>
< artifactId> docx4j-ImportXHTML< / artifactId>
< version> 3.3.1< / version>
< /依赖关系>


How can I convert HTML from a CKEditor into a Microsoft Word document?

解决方案

I wrote a java method to achieve it using api docx4j-ImportXHTML.

The idea is to create method which takes xhtml, resultant filename and path at which the new file to be saved. This file will process the xhtml and will save it as file with provided filename and at given destination. Check Full code link for complete code.

To add dependency docx4j-ImportXHTML, use(3.3.1 is latest version while I am writing this answer. If you seeing it later use latest stable version of your time).

<dependency>
    <groupId>org.docx4j</groupId>
    <artifactId>docx4j-ImportXHTML</artifactId>
    <version>3.3.1</version>
</dependency>

这篇关于如何将HTML转换为Microsoft Word文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆