Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Line Numbering

LineNumbering

Click Line Numbering Options… to invoke the Line Numbers Dialog.

To switch line numbering on, specify the SectionLineNumbering.CountBy property to any non-zero positive integer value. Other parameters can be set up as illustrated below.

Note

The RichEditView.AllowDisplayLineNumbers property enables you to show or hide line numbers in a view.

The following code snippet enables line numbering for the first section in the loaded document. Line numbering starts at number one and restarts at the new section. Numbers are displayed on each second line and are indented from the text at a distance equal to 0.25 of an inch.

View Example

document.LoadDocument("Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml);
document.Unit = DevExpress.Office.DocumentUnit.Inch;
Section sec = document.Sections[0];
sec.LineNumbering.CountBy = 2;
sec.LineNumbering.Start = 1;
sec.LineNumbering.Distance = 0.25f;
sec.LineNumbering.RestartType = LineNumberingRestart.NewSection;
See Also