com.aspose.words

Class SectionLayoutMode

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

Utility class containing constants. Specifies the layout mode for a section allowing to define the document grid behavior.

Example:

Shows how to create headers and footers different for first, even and odd pages using DocumentBuilder.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

PageSetup pageSetup = builder.getPageSetup();
pageSetup.setDifferentFirstPageHeaderFooter(true);
pageSetup.setOddAndEvenPagesHeaderFooter(true);
pageSetup.setLayoutMode(SectionLayoutMode.LINE_GRID);
pageSetup.setCharactersPerLine(1);
pageSetup.setLinesPerPage(1);

builder.moveToHeaderFooter(HeaderFooterType.HEADER_FIRST);
builder.writeln("First page header.");

builder.moveToHeaderFooter(HeaderFooterType.HEADER_EVEN);
builder.writeln("Even pages header.");

builder.moveToHeaderFooter(HeaderFooterType.HEADER_PRIMARY);
builder.writeln("Odd pages header.");

// Move back to the main story of the first section
builder.moveToSection(0);
builder.writeln("Text page 1.");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.writeln("Text page 2.");
builder.insertBreak(BreakType.PAGE_BREAK);
builder.writeln("Text page 3.");

doc.save(getArtifactsDir() + "PageSetup.DifferentHeaders.docx");

Field Summary
static final intDEFAULT = 0
Specifies that no document grid shall be applied to the contents of the corresponding section in the document.
static final intGRID = 1
Specifies that the corresponding section shall have both the additional line pitch and character pitch added to each line and character within it in order to maintain a specific number of lines per page and characters per line. Characters will not be automatically aligned with gridlines on typing.
static final intLINE_GRID = 2
Specifies that the corresponding section shall have additional line pitch added to each line within it in order to maintain the specified number of lines per page.
static final intSNAP_TO_CHARS = 3
Specifies that the corresponding section shall have both the additional line pitch and character pitch added to each line and character within it in order to maintain a specific number of lines per page and characters per line. Characters will be automatically aligned with gridlines on typing.
 

    • Field Detail

      • DEFAULT = 0

        public static final int DEFAULT
        Specifies that no document grid shall be applied to the contents of the corresponding section in the document.
      • GRID = 1

        public static final int GRID
        Specifies that the corresponding section shall have both the additional line pitch and character pitch added to each line and character within it in order to maintain a specific number of lines per page and characters per line. Characters will not be automatically aligned with gridlines on typing.
      • LINE_GRID = 2

        public static final int LINE_GRID
        Specifies that the corresponding section shall have additional line pitch added to each line within it in order to maintain the specified number of lines per page.
      • SNAP_TO_CHARS = 3

        public static final int SNAP_TO_CHARS
        Specifies that the corresponding section shall have both the additional line pitch and character pitch added to each line and character within it in order to maintain a specific number of lines per page and characters per line. Characters will be automatically aligned with gridlines on typing.