PageSetupLineNumberDistanceFromText Property

Gets or sets distance between the right edge of line numbers and the left edge of the document.

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

ExpandedSyntax

public double LineNumberDistanceFromText { get; set; }

Property Value

Type: Double

ExpandedRemarks

Set this property to zero for automatic distance between the line numbers and text of the document.

ExpandedExamples

Shows how to enable Microsoft Word line numbering for a section.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Line numbering for each section can be configured via PageSetup
PageSetup pageSetup = builder.PageSetup;
pageSetup.LineStartingNumber = 1;
pageSetup.LineNumberCountBy = 3;
pageSetup.LineNumberRestartMode = LineNumberRestartMode.RestartPage;
pageSetup.LineNumberDistanceFromText = 50.0d;

// LineNumberCountBy is set to 3, so every line whose number is a multiple of 3
// will display that line number to the left of the text
for (int i = 1; i <= 25; i++)
    builder.Writeln($"Line {i}.");

// The line counter will skip any paragraph with this flag set to true
// Normally, the number "15" would normally appear next to this paragraph, which says "Line 15"
// Since we set this flag to true and this paragraph is not counted by numbering,
// number 15 will appear next to the next paragraph, "Line 16", and from then on counting will carry on as normal
// until it will restart according to LineNumberRestartMode
doc.FirstSection.Body.Paragraphs[14].ParagraphFormat.SuppressLineNumbers = true;

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

ExpandedSee Also