开发者

Apache POI. How do I set the page layout / paper size for a Word document?

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.

How do I set the page layout / paper size for a Word document?

Can anyone point me to useful examples for using POI to create Word documents?


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

 Document document = new Document(PageSize.A4);


In C# with NPOI I use

document.PageLayout.Orientation = Orientation.Landscape;

or

document.PageLayout.Orientation = Orientation.Portrait;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜