Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active April 10, 2022 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/0e88b7ea17c45581f7d9d70cdaf1cd35 to your computer and use it in GitHub Desktop.
Save GroupDocsGists/0e88b7ea17c45581f7d9d70cdaf1cd35 to your computer and use it in GitHub Desktop.
Change Orientation of Word Document in C#
// How to change page orientation of Word document to Landscape using C#
using (Merger merger = new Merger("path/document.docx"))
{
OrientationOptions orientationOptions = new OrientationOptions(OrientationMode.Landscape, new int[] { 1, 2 });
merger.ChangeOrientation(orientationOptions);
merger.Save("path/orientation-landscape-document.docx");
}
// How to change page orientation of Word document to Portrait using C#
using (Merger merger = new Merger("path/document.docx"))
{
OrientationOptions orientationOptions = new OrientationOptions(OrientationMode.Portrait, new int[] { 3, 4 });
merger.ChangeOrientation(orientationOptions);
merger.Save("path/orientation-portrait-document.docx");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment