Free Support Forum -

Change Page Orientation AFTER report is written

It looks like the PageSetup.Orientation setting of the DocumentBuilder only works for the content that follows. But is there a way to change a page orientation after I’ve written the content of my document?

The functionality I’m trying to implement is: produce a Document and save it in different layouts, for example, save as Portrait in Word Doc and Landscape in PDF. Is this doable without producing the report twice???


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Yes, of course, you can achieve this. Page orientation is an option of section in Word documents. So if you need to change page orientation of the whole document, you should loop through all sections and change orientation of each section. For example see the following code:

// Open source document.

Document doc = new Document(@"Test001\in.doc");

// Loop through all section.

foreach (Section section in doc.Sections)


// Change page orientation.

section.PageSetup.Orientation = Orientation.Landscape;


// Save output document.


Hope this helps.

Best regards,