Apache的POI。我如何设置一个Word文档的页面布局/纸张尺寸? [英] Apache POI. How do I set the page layout / paper size for a Word document?

查看:2538
本文介绍了Apache的POI。我如何设置一个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?

推荐答案

例如,如果您想设置您可以使用此code中的A4幅面:

For example if you want to set the A4-format you can use this code:

 Document document = new Document(PageSize.A4);

这篇关于Apache的POI。我如何设置一个Word文档的页面布局/纸张尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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