public class SectionLayoutMode
extends java.lang.Object
Examples:
Shows how to specify a limit for the number of lines that each page may have.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Enable pitching, and then use it to set the number of lines per page in this section.
// A large enough font size will push some lines down onto the next page to avoid overlapping characters.
builder.getPageSetup().setLayoutMode(SectionLayoutMode.LINE_GRID);
builder.getPageSetup().setLinesPerPage(15);
builder.getParagraphFormat().setSnapToGrid(true);
for (int i = 0; i < 30; i++)
builder.write("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ");
doc.save(getArtifactsDir() + "PageSetup.LinesPerPage.docx");
Shows how to specify a for the number of characters that each line may have.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Enable pitching, and then use it to set the number of characters per line in this section.
builder.getPageSetup().setLayoutMode(SectionLayoutMode.GRID);
builder.getPageSetup().setCharactersPerLine(10);
// The number of characters also depends on the size of the font.
doc.getStyles().get("Normal").getFont().setSize(20.0);
Assert.assertEquals(8, doc.getFirstSection().getPageSetup().getCharactersPerLine());
builder.writeln("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
doc.save(getArtifactsDir() + "PageSetup.CharactersPerLine.docx");
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT
Specifies that no document grid shall be applied to the contents of the corresponding section in the document.
|
static 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.
|
static int |
length |
static 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 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.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String sectionLayoutModeName) |
static java.lang.String |
getName(int sectionLayoutMode) |
static int[] |
getValues() |
static java.lang.String |
toString(int sectionLayoutMode) |
public static int DEFAULT
public static int GRID
public static int LINE_GRID
public static int SNAP_TO_CHARS
public static int length