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 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");
Example:
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");
Field Summary |
static final int | DEFAULT = 0 | |
Specifies that no document grid shall be applied to the contents of the corresponding section in the document.
|
static final int | GRID = 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 int | LINE_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 int | SNAP_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.
|
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.
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.