Back to Devexpress

AbstractNumberingList Interface

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-6956f270.md

latest6.8 KB
Original Source

AbstractNumberingList Interface

Serves as a pattern for numbered and bulleted lists to define their appearance.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
[ComVisible(true)]
public interface AbstractNumberingList :
    NumberingListBase
vb
<ComVisible(True)>
Public Interface AbstractNumberingList
    Inherits NumberingListBase

The following members return AbstractNumberingList objects:

Remarks

You cannot use the AbstractNumberingList objects directly to apply numbering to paragraphs. The NumberingList instance is an actual list representation. Use the AbstractNumberingListCollection.Add method to create a list pattern. Use the NumberingListCollection.Add method with the index of the abstract numbering list as a parameter to create an actual list that can be applied to paragraphs.

The following code snippets illustrate how to create bulleted and numbered list.

Example: Create a Bulleted List

View Example

csharp
Document document = server.Document;
document.BeginUpdate();

// Create a new list pattern object
AbstractNumberingList list = document.AbstractNumberingLists.Add();

//Specify the list's type
list.NumberingType = NumberingType.Bullet;
ListLevel level = list.Levels[0];

//Set the left indent of the list
level.ParagraphProperties.LeftIndent = 100;

//Specify the bullets' format
//Without this step, the list is considered as numbered
level.DisplayFormatString = "\u00B7";
level.CharacterProperties.FontName = "Symbol";

//Create a new list based on the specific pattern
NumberingList bulletedList = document.NumberingLists.Add(0);

// Add paragraphs to the list
ParagraphCollection paragraphs = document.Paragraphs;
paragraphs.AddParagraphsToList(document.Range, bulletedList, 0);

document.EndUpdate();
vb
Dim document As Document = server.Document
document.BeginUpdate()

' Create a new list pattern objects
Dim list As AbstractNumberingList = document.AbstractNumberingLists.Add()

' Specify the list's type
list.NumberingType = NumberingType.Bullet
Dim level As ListLevel = list.Levels(0)

' Set the left indent of the list
level.ParagraphProperties.LeftIndent = 100

' Specify the bullet's format
' Without this step, the list is considered as numbered
level.DisplayFormatString = "·"
level.CharacterProperties.FontName = "Symbol"

' Create a new list based on the specific pattern
Dim bulletedList as NumberingList = document.NumberingLists.Add(0)

' Add paragraphs to the list
Dim paragraphs As ParagraphCollection = document.Paragraphs
paragraphs.AddParagraphsToList(document.Range, bulletedList, 0)
document.EndUpdate()

Example: Create a Numbered List

View Example

csharp
Document document = server.Document;

document.BeginUpdate();

//Create a new pattern object
AbstractNumberingList abstractListNumberingRoman = document.AbstractNumberingLists.Add();

//Specify the list's type
abstractListNumberingRoman.NumberingType = NumberingType.Simple;

//Define the first level's properties
ListLevel level = abstractListNumberingRoman.Levels[0];
level.ParagraphProperties.LeftIndent = 150;

// Align list with the surrounding text
level.ParagraphProperties.FirstLineIndentType = ParagraphFirstLineIndent.Hanging;
level.ParagraphProperties.FirstLineIndent = 75;
level.Start = 1;

//Specify the roman format
level.NumberingFormat = NumberingFormat.LowerRoman;
level.DisplayFormatString = "{0}.";

//Create a new list based on the specific pattern
NumberingList numberingList = document.NumberingLists.Add(0);

document.EndUpdate();

document.BeginUpdate();
ParagraphCollection paragraphs = document.Paragraphs;
//Add paragraphs to the list
paragraphs.AddParagraphsToList(document.Range, numberingList, 0);
document.EndUpdate();
vb
document.BeginUpdate()

'Create a new pattern object
Dim abstractListNumberingRoman As AbstractNumberingList = document.AbstractNumberingLists.Add()

'Specify the list's type
abstractListNumberingRoman.NumberingType = NumberingType.Simple

'Define the first level's properties
Dim level As ListLevel = abstractListNumberingRoman.Levels(0)
level.ParagraphProperties.LeftIndent = 150

' Align list with the surrounding text
level.ParagraphProperties.FirstLineIndentType = ParagraphFirstLineIndent.Hanging
level.ParagraphProperties.FirstLineIndent = 75

level.Start = 1
level.NumberingFormat = NumberingFormat.LowerRoman
level.DisplayFormatString = "{0}."

'Create a new list based on the specific pattern
Dim numberingList As NumberingList = document.NumberingLists.Add(0)
document.EndUpdate()

document.BeginUpdate()
Dim paragraphs As ParagraphCollection = document.Paragraphs

'Add paragraphs to the list
paragraphs.AddParagraphsToList(document.Range, numberingList, 0)
document.EndUpdate()

See Also

AbstractNumberingList Members

NumberingList

Native.ListLevel

ListIndex

Paragraph.ListLevel

DevExpress.XtraRichEdit.API.Native Namespace