This project has moved. For the latest updates, please go here.

Portrait & Landscape

Nov 7, 2011 at 3:10 PM

 

Any idea to change a document, a page mode from portrait to landscape or vice versa.

Thanks.

Regards.

Coordinator
Nov 7, 2011 at 3:23 PM
Hi mafpinedo,

this can be achieved as follows.

Kind regards,
Cathal

// Create a new document.
using (DocX document = DocX.Create(@"C:\Users\Cathal\Desktop\Hello.docx"))
{
// Set this documents orientation to landscape and save.
document.PageLayout.Orientation = Orientation.Landscape;
document.SaveAs(@"Landscape.docx");

// Set this documents orientation to portrait and save.
document.PageLayout.Orientation = Orientation.Portrait;
document.SaveAs(@"Portrait.docx");
}
Aug 1, 2013 at 3:00 PM
Hi,

I'm trying to create a Word document with Landscape Orientation in my project using DocX 1.0.0.12. As Cathal suggested above I have tried code line "document.PageLayout.Orientation", but getting an error saying "Novacode.DocX does not contain a definition for pageLayout......."

Can anyone help me on this?

Regards,
Mithun.