使用java对象中的值动态地从模板创建word文档 [英] Creating a word document from a template dynamically using values from java objects

查看:413
本文介绍了使用java对象中的值动态地从模板创建word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从HTML页面创建word文档。
我打算在HTML页面上获取值,然后将这些值传递给文档模板。
我使用 JSOUP 来解析HTML页面的内容,并在java程序中获取值。我现在想将这些值传递给word文档模板。
我想知道什么是我可以用来创建文档模板的最佳技术,并将值传递给模板来创建word文档。

I want to create a word document from an HTML page. I am planning to get the values on the HTML page and then pass these values to a document template. I have used JSOUP to parse the contents of the HTML page and I get the values in my java program. I now want to pass these values to a word document template. I want to know what are the best techniques I can use to create the document template and pass the values to the template to create the word document.

谢谢你。

推荐答案

我发现了一些非常有趣和简单的东西。我们只需要为我们想要创建的文档创建一个简单的.xml模板,然后以编程方式更改xml文件的内容并将其另存为ms word文档。

I found something very Interesting and simple. We just need to create a simple .xml template for the document we want to create and then programmatically change the contents of the xml file and save it as a ms word document.

您可以在这里找到xml模板和代码

You can find the xml template and the code here.

这篇关于使用java对象中的值动态地从模板创建word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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