Setting PageMargins with in Aspose.Word


could you please help me with setting up the page margins with in a document, when creating a new document with mailmerge. I found the pagesetup object where i can setup the margins but couldn't find a place to apply those settings to the document itself.

Thanks in advance.


Page setup and margins in MS Word apply to each section separately. If you have only one section you have only one page setup.

You can change page setup either on Section directly:
Document.Sections[ n ].PageSetup

Or in the document builder for the section that is currently being built:


pagesetup member is not available for doc.Sections[0] object. Is it because i am using trial version or am i missing some thing.

Here is the code i am using

Word word = new Word();

Aspose.Word.Document doc = word.Open(@“c:…\templates\Template.doc”);

new string[] {“field1”,“field2”},new string[] {fieldVal1, fieldVal2});

doc.Sections[0]. ********pagesetup member is not avaiable




Just get the latest hotfix of Aspose.Word, this property appeared only a week ago or so.


thanks for all the help … I got it working with the document builder