向 ms word 添加内容,包括宏

发布于 2024-08-07 12:04:54 字数 190 浏览 2 评论 0原文

我有一个 JSP 文件,通过设置 content-type 关键字将数据库中的所有数据刷新到 MS-Word 文档中。

我需要将页眉和页脚添加到同一文档中。如果不使用像 POI 这样的 API,我无法从 JSP 中找到直接的方法。所以我创建了一个在本地运行的宏。

如何将其添加到动态生成的 Word 文件中?

I have a JSP file to flush all data from database into a MS-Word document by setting the content-type keyword.

I need to add header and footer to the same document. I couldn't find a direct way from JSP without using APIs like POI. So I created a macro which works locally.

How do I add this to a dynamically generated Word file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

や莫失莫忘 2024-08-14 12:04:54

我在使用 POI 和 Excel 时也遇到了类似的问题。

解决方案是手动创建一个包含宏的模板 .doc 文件。然后在您的代码中加载该文档,用您的数据修改它,然后保存它。宏将从模板文档中保留。

I had a similar problem with POI and Excel.

The solution is to manually create a template .doc file, with the macro present. Then in your code, load that document, amend it with your data, and save it. The macro will be preserved from the template document.

苄①跕圉湢 2024-08-14 12:04:54

我将使用 POI 或 docx4j 在服务器上创建 docx 文件,并添加页眉/页脚作为该过程的一部分。

I'd use POI or docx4j to create a docx file on the server, and add the header/footer as part of that process.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文