New to Telerik Document ProcessingStart a free 30-day trial

List

Updated on Jun 3, 2026

The List class helps you create a list of numbered paragraphs. You can use lists by adding them to the RadFixedDocumentEditor Lists collection or by creating List class instances and setting the list bullets to some Block instances.

Figure 1

List example showing numbered and bulleted paragraphs

The following sections present the list-related API in RadPdfProcessing:

Creating List from ListTemplateType

Each List contains a ListLevelCollection where the presentation of each list level is defined by a ListLevel class instance. For the most common cases you do not need to define each separate list level. Instead, you can use the ListTemplateType enumeration to create a list with one of the predefined list templates.

The code snippet from Example 1 shows how to create a list with the NumberedParentheses template.

Example 1: Create numbered parentheses list template type

C#
List numberedParenthesesList = new List(ListTemplateType.NumberedParentheses);

The following image shows the available list template types and their appearance:

Figure 2

Available list template types and their appearance

In .NET Standard due to font limitations, the BulletDefault list requires a Wingdings font be provided so its bullets are rendered properly. You can read how to handle these restrictions in the Fonts and FontsProvider articles.

Creating Custom ListLevel

When you need to create a custom List, define the presentation of each list level. The appearance of the list level is defined with the properties of the ListLevel class. The following list level properties are available in RadPdfProcessing:

  • StartIndex: Specifies the index from which the list items numbering starts. The default value of this property is 1.

  • RestartAfterLevel: Specifies the index of the level, which restarts the current level numbering. The default value is negative, which means that all previous levels restart the current level numbering. If this property has a non-negative value, all previous levels that have a level index less than or equal to the RestartAfterLevel value restart the current level numbering.

  • ParagraphProperties: Specifies the paragraph properties of the paragraphs from this list level.

  • CharacterProperties: Specifies the character properties of the bullet element on this list level.

  • BulletNumberingFormat: Specifies how the bullet element is formatted on this list level.

  • IndentAfterBullet: Specifies the amount of indent after the bullet element.

Example 2 shows how to create an empty list and add two custom list levels to its ListLevelsCollection. Level 0 has a bullet which displays its current numbering as a two-digit number with a leading zero. Level 1 displays a checkbox as a bullet symbol for all of the corresponding list items. Additionally, each of the levels defines custom values for the LeftIndent, ForegroundColor, and IndentAfterBullet properties.

Example 2: Create custom list levels

C#
List bulletList = new List();

ListLevel levelZero = bulletList.Levels.AddListLevel();
levelZero.ParagraphProperties.LeftIndent = 30;
levelZero.CharacterProperties.ForegroundColor = new RgbColor(100, 100, 100);
levelZero.IndentAfterBullet = 5;
levelZero.BulletNumberingFormat =
    new TextBulletNumberingFormat((indexer) => string.Format("{0:D2}.", indexer.GetCurrentIndex(0)));

ListLevel levelOne = bulletList.Levels.AddListLevel();
levelOne.ParagraphProperties.LeftIndent = 60;
levelOne.CharacterProperties.ForegroundColor = new RgbColor(100, 100, 100);
levelOne.IndentAfterBullet = 10;
levelOne.BulletNumberingFormat = new TextBulletNumberingFormat((indexer) => "☑");

The image in Figure 3 shows how the list created in Example 2 looks when used.

Figure 3

Custom list levels with two-digit numbering and checkbox bullets

Creating Custom Bullet

When you create a custom list level, you need to specify how the bullet numbering is formatted. With RadPdfProcessing, by implementing IBulletNumberingFormat you can choose what PositionContentElement to use for each bullet appearance. This way, knowing the current indexes of all list levels, you can create bullets with text, geometry, or image.

If you need a text bullet, use the TextBulletNumberingFormat class. This class implements IBulletNumberingFormat. When you initialize an instance of this class, its constructor requires a function that returns the string representation of the bullet.

The following code snippet shows how to create the bullets of a numbered hierarchical list using the TextBulletNumberingFormat class:

Example 3: Create custom text numbering bullet

C#
List list = new List();

for (int i = 0; i < 3; i++)
{
    ListLevel level = list.Levels.AddListLevel();
    level.ParagraphProperties.LeftIndent = (i + 1) * 20;
    level.IndentAfterBullet = 10;
    int currentLevelIndex = i;

    level.BulletNumberingFormat = new TextBulletNumberingFormat((indexer) =>
    {
        StringBuilder builder = new StringBuilder();

        for (int levelIndex = 0; levelIndex <= currentLevelIndex; levelIndex++)
        {
            builder.AppendFormat("{0}.", indexer.GetCurrentIndex(levelIndex));
        }

        return builder.ToString();
    });
}

When using the list created in Example 3, its bullets look as shown in Figure 4.

Figure 4

Custom hierarchical numbered list bullets

Using Lists with RadFixedDocumentEditor

To use lists with RadFixedDocumentEditor, first add them to the editor ListCollection. Each time you add a list item, set the ListId and ListLevel values in the editor Paragraph properties and call the InsertParagraph() method.

Example 4 shows how to create a list with RadFixedDocumentEditor and insert a single item for each of the list levels. The appearance of the list comes from the values in the predefined ListTemplateType enumeration.

Example 4: Using lists with RadFixedDocumentEditor

C#
RadFixedDocument document = new RadFixedDocument();
using (RadFixedDocumentEditor editor = new RadFixedDocumentEditor(document))
{
    List numlist = editor.Lists.AddList(ListTemplateType.NumberedDefault);
    editor.ParagraphProperties.ListId = list.Id;

    for (int listLevel = 0; listLevel < list.Levels.Count; listLevel++)
    {
        editor.ParagraphProperties.ListLevel = listLevel;
        editor.InsertParagraph();
        editor.InsertRun(string.Format("List level {0}", listLevel));
    }
}

The resulting document looks like the image in Figure 5.

Figure 5

List created with RadFixedDocumentEditor showing items at different levels

Using Lists with Block Class

As the Block class has Bullet and IndentAfterBullet properties, you can set a custom bullet to any Block instance. However, if you want to get an automatically formatted bullet corresponding to some List class instance, use the SetBullet(List list, int listLevel) method. This way you can set the bullet-related properties so that the bullet displays the correct list numbering and formatting.

The following code snippet shows how to create a List with BulletDefault template and set the bullet of the first list level to a Block:

Example 5: Using lists with Block class

C#
List defaultBulletlist = new List(ListTemplateType.BulletDefault);
Block block = new Block();
block.SetBullet(defaultBulletlist, 0);
block.InsertText("Sample block text.");

The list style is applied for the whole Block element. To generate a list consisting of several paragraphs in different list items, use the same count of Block instances as the number of the different list items.

Figure 6 demonstrates how the block from Example 5 looks when exported.

Figure 6

Block with BulletDefault list style applied

See Also