paul
paul

Reputation: 13516

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?

Upvotes: 0

Views: 5277

Answers (2)

Maxim Kharin
Maxim Kharin

Reputation: 11

In C# with NPOI I use

document.PageLayout.Orientation = Orientation.Landscape;

or

document.PageLayout.Orientation = Orientation.Portrait;

Upvotes: 0

Ismet
Ismet

Reputation: 99

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

 Document document = new Document(PageSize.A4);

Upvotes: 2

Related Questions