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;
精彩评论