PageSetupLinesPerPage Property

Gets or sets the number of lines per page in the document grid.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.10.0

ExpandedSyntax

public int LinesPerPage { get; set; }

Property Value

Type: Int32

ExpandedRemarks

Minimum value of the property is 1. Maximum value depends on page height and font size of the Normal style. Minimum line pitch is 136 percent of the font size. For example, maximum number of lines per page of a Letter page with one-inch margins is 39.

By default, the property has a value, on which line pitch is in 1.5 times greater than font size of the Normal style.

ExpandedExamples

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.PageSetup;
pageSetup.DifferentFirstPageHeaderFooter = true;
pageSetup.OddAndEvenPagesHeaderFooter = true;
pageSetup.LayoutMode = SectionLayoutMode.LineGrid;
pageSetup.CharactersPerLine = 1;
pageSetup.LinesPerPage = 1;

builder.MoveToHeaderFooter(HeaderFooterType.HeaderFirst);
builder.Writeln("First page header.");

builder.MoveToHeaderFooter(HeaderFooterType.HeaderEven);
builder.Writeln("Even pages header.");

builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
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.PageBreak);
builder.Writeln("Text page 2.");
builder.InsertBreak(BreakType.PageBreak);
builder.Writeln("Text page 3.");

doc.Save(ArtifactsDir + "PageSetup.DifferentHeaders.docx");

ExpandedSee Also