public class SectionLayoutMode
Example:
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 int | DEFAULT | |
Specifies that no document grid shall be applied to the contents of the corresponding section in the document.
|
||
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.
|
||
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.
|
||
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.
|
public static final int DEFAULT
public static final int GRID
public static final int LINE_GRID
public static final int SNAP_TO_CHARS