Edit

Word.PageOrientation enum

Specifies a page layout orientation.

Remarks

API set: WordApiDesktop 1.3

Used by

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/50-document/manage-section-starts.yaml

await Word.run(async (context) => {

  // Configure document-wide page settings for a report that will be printed and bound.
  const pageSetup: Word.PageSetup = context.document.pageSetup;
  pageSetup.set({
    paperSize: Word.PaperSize.letter,
    orientation: Word.PageOrientation.portrait,
    topMargin: 72,
    bottomMargin: 72,
    leftMargin: 90,
    rightMargin: 72,
    gutter: 18,
    gutterPosition: Word.GutterPosition.left,
    mirrorMargins: true,
    oddAndEvenPagesHeaderFooter: true
  });

  const sections: Word.SectionCollection = context.document.sections;
  sections.load("items");
  await context.sync();

  // Start the main chapter on an odd-numbered page so it appears on the right in a bound document.
  const chapterPageSetup: Word.PageSetup = sections.items[1].pageSetup;
  chapterPageSetup.sectionStart = Word.SectionStart.oddPage;
  chapterPageSetup.differentFirstPageHeaderFooter = true;

  // Keep the appendix in a separate section, but let it begin on the current page.
  sections.items[2].pageSetup.sectionStart = Word.SectionStart.continuous;

  await context.sync();
  console.log("Applied print and binding settings to the report.");
});

Fields

landscape = "Landscape"

Landscape orientation.

portrait = "Portrait"

Portrait orientation.