PageSetupCharactersPerLine Property

Gets or sets the number of characters per line in the document grid.

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

ExpandedSyntax

public int CharactersPerLine { get; set; }

Property Value

Type: Int32

ExpandedRemarks

Minimum value of the property is 1. Maximum value depends on page width and font size of the Normal style. Minimum character pitch is 90 percent of the font size. For example, maximum number of characters per line of a Letter page with one-inch margins is 43.

By default, the property has a value, on which character pitch equals to 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