Managed to dig out some old code last night and I might - that is MIGHT -
have found a solution. If you get the chance, try something like this
please;

Open the Word document.
Get the overall range object for the document.
>From the Range object, find out how many Paragraphs there are in the
document.
Iterate through the Paragraphs - get each in turn from the Range object -
and try to get the Section information form the Paragraph. The old code I
looked at suggested that the Section info will be bound to the final
Paragraph in the section or to the final paragraph in the document if it
contains just one section.
Once you have a Section object in hand, get The SectionDescriptor from it.
This object inherits methods that I think - big THINK again - will allow you
to set the sizes of the margins. These methods have names like this -
'field_43_dxaLeft' - and expect to receive an integer argument.
Try calling the above to set the left hand margin - and I am guessing that
this is what the method will do - before saving the file away again.
Open the file with Word to see what the result of that change was.

If I have the time to put together and run some test code before you do, i
will post the results here.

Yours

Mark B

--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/How-to-change-margins-of-a-word-document-tp5710067p5710108.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to