Class Orientation

  • java.lang.Object
    • com.aspose.words.Orientation
public class Orientation 
extends java.lang.Object

Utility class containing constants. Specifies page orientation.


Shows how to apply and revert page setup settings to sections in a document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Modify the page setup properties for the builder's current section and add text.
builder.writeln("This is the first section, which landscape oriented with vertically centered text.");

// If we start a new section using a document builder,
// it will inherit the builder's current page setup properties.

Assert.assertEquals(Orientation.LANDSCAPE, doc.getSections().get(1).getPageSetup().getOrientation());
Assert.assertEquals(PageVerticalAlignment.CENTER, doc.getSections().get(1).getPageSetup().getVerticalAlignment());

// We can revert its page setup properties to their default values using the "ClearFormatting" method.

Assert.assertEquals(Orientation.PORTRAIT, doc.getSections().get(1).getPageSetup().getOrientation());
Assert.assertEquals(PageVerticalAlignment.TOP, doc.getSections().get(1).getPageSetup().getVerticalAlignment());

builder.writeln("This is the second section, which is in default Letter paper size, portrait orientation and top alignment."); + "PageSetup.ClearFormatting.docx");

Field Summary
static final intPORTRAIT = 1
Portrait page orientation (narrow and tall).
static final intLANDSCAPE = 2
Landscape page orientation (wide and short).

    • Field Detail

      • PORTRAIT = 1

        public static final int PORTRAIT
        Portrait page orientation (narrow and tall).
      • LANDSCAPE = 2

        public static final int LANDSCAPE
        Landscape page orientation (wide and short).