officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-e9f14a48.md
Defines line numbers in the left margin or to the left of each column in the document’s Section.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
[ComVisible(true)]
public interface SectionLineNumbering
<ComVisible(True)>
Public Interface SectionLineNumbering
The following members return SectionLineNumbering objects:
The SectionLineNumbering interface is accessible via the Section.LineNumbering property of the document’s section.
By default, line numbering is suppressed. To switch line numbering on, set the AllowDisplayLineNumbers property of the required view to true and also set the SectionLineNumbering.CountBy property to any non-zero positive integer value.
View Example: Word Processing Document API – How to Process Word Documents in Code
using DevExpress.XtraRichEdit.API.Native;
using DevExpress.XtraRichEdit;
using DevExpress.Office;
static void LineNumbering(RichEditDocumentServer wordProcessor) {
// Load a document from a file.
wordProcessor.LoadDocument("Documents\\Grimm.docx", DocumentFormat.Docx);
// Access a document.
Document document = wordProcessor.Document;
// Specify the document’s measure units.
document.Unit = DevExpress.Office.DocumentUnit.Inch;
// Access the first document section.
Section sec = document.Sections[0];
// Specify line numbering parameters for the section.
sec.LineNumbering.CountBy = 2;
sec.LineNumbering.Start = 1;
sec.LineNumbering.Distance = 0.25f;
sec.LineNumbering.RestartType = LineNumberingRestart.NewSection;
}
Imports DevExpress.XtraRichEdit.API.Native
Imports DevExpress.XtraRichEdit
Imports DevExpress.Office
Private Shared Sub LineNumbering(ByVal wordProcessor As RichEditDocumentServer)
' Load a document from a file.
wordProcessor.LoadDocument("Documents\Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.Docx)
' Access a document.
Dim document As Document = wordProcessor.Document
' Specify the document’s measure units.
document.Unit = DocumentUnit.Inch
' Access the first document section.
Dim sec As Section = document.Sections(0)
' Specify line numbering parameters for the section.
sec.LineNumbering.CountBy = 2
sec.LineNumbering.Start = 1
sec.LineNumbering.Distance = 0.25F
sec.LineNumbering.RestartType = LineNumberingRestart.NewSection
End Sub
See Also