阿帕奇兴趣点.如何设置 Word 文档的页面布局/纸张大小? [英] Apache POI. How do I set the page layout / paper size for a Word document?
本文介绍了阿帕奇兴趣点.如何设置 Word 文档的页面布局/纸张大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 Apache POI 包从头开始创建 Word 文档.输出简单格式的文本尚未证明是一个问题,但我想更改页面大小.
I am trying to create a Word document from scratch using the Apache POI package. Outputting simply-formatted text has not proved to be a problem but I would like to change the page size.
如何设置 Word 文档的页面布局/纸张大小?
How do I set the page layout / paper size for a Word document?
谁能给我指点一下使用 POI 创建 Word 文档的有用示例?
Can anyone point me to useful examples for using POI to create Word documents?
推荐答案
例如如果你想设置 A4 格式你可以使用这个代码:
For example if you want to set the A4-format you can use this code:
Document document = new Document(PageSize.A4);
这篇关于阿帕奇兴趣点.如何设置 Word 文档的页面布局/纸张大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文