开发者

Adding content to ms word, Include macro

开发者 https://www.devze.com 2022-12-08 17:13 出处:网络
I have a JSP file to flush all data from database into a MS-Word document by setting the content-type keyword.

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 dynam开发者_如何转开发ically generated Word file?


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消