Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
What is this page about?
This page explains how to modify page setup properties (margins, size, orientation) for an entire document using Aspose.Words.
Page setup is a set of formatting attributes which is stored in each section of a Word document. Microsoft Word Automation’s ActiveDocument.Range.PageSetup is a “shortcut” to set the same page setup for all sections of a document. Aspose.Words only provides access to the page setup of individual sections via the Section.PageSetup property so any document-wide changes to page setup must be applied for all sections.
string mypath = "Document.docx";
Word.Application wordApp = Application;
wordApp.Documents.Open(mypath);
this.Application.ActiveDocument.Range(1,2).PageSetup.PaperSize = Word.WdPaperSize.wdPaperLetter;
Document doc = new Document( "Section.ModifyPageSetupInAllSections.doc");
// It is important to understand that a document can contain many sections and each
// section has its own page setup. In this case we want to modify them all.
foreach (Section section in doc)
section.PageSetup.PaperSize = PaperSize.Letter;
doc.Save( "Section.ModifyPageSetupInAllSections Out.doc");
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.