Setting PageMargins with in Aspose.Word


#1

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.


#2

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:
DocumentBuilder.PageSetup


#3

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”);

doc.MailMerge.Execute(
new string[] {“field1”,“field2”},new string[] {fieldVal1, fieldVal2});

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

doc.Save(“orderDoc.doc”,SaveFormat.FormatDocument);

Thanks


#4

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

http://www.aspose.com/Products/Aspose.Word/Api/Aspose.Word.SectionMembers.html


#5

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