ListLevel Class

Defines formatting for a list level.

ExpandedInheritance Hierarchy

SystemObject
  Aspose.Words.ListsListLevel

Namespace:  Aspose.Words.Lists
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.11.0

ExpandedSyntax

public class ListLevel

The ListLevel type exposes the following members.

ExpandedProperties

  NameDescription
Public propertyCode exampleAlignment
Gets or sets the justification of the actual number of the list item.
Public propertyCode exampleFont
Specifies character formatting used for the list label.
Public propertyImageData
Returns image data of the picture bullet shape for the current list level.
Public propertyCode exampleIsLegal
True if the level turns all inherited numbers to Arabic, false if it preserves their number style.
Public propertyCode exampleLinkedStyle
Gets or sets the paragraph style that is linked to this list level.
Public propertyCode exampleNumberFormat
Returns or sets the number format for the list level.
Public propertyCode exampleNumberPosition
Returns or sets the position (in points) of the number or bullet for the list level.
Public propertyCode exampleNumberStyle
Returns or sets the number style for this list level.
Public propertyCode exampleRestartAfterLevel
Sets or returns the list level that must appear before the specified list level restarts numbering.
Public propertyCode exampleStartAt
Returns or sets the starting number for this list level.
Public propertyCode exampleTabPosition
Returns or sets the tab position (in points) for the list level.
Public propertyCode exampleTextPosition
Returns or sets the position (in points) for the second line of wrapping text for the list level.
Public propertyCode exampleTrailingCharacter
Returns or sets the character inserted after the number for the list level.

ExpandedMethods

  NameDescription
Public methodCode exampleCreatePictureBullet
Creates picture bullet shape for the current list level.
Public methodCode exampleDeletePictureBullet
Deletes picture bullet for the current list level.
Public methodEquals(Object) (Inherited from Object.)
Public methodEquals(ListLevel)
Compares with the specified ListLevel.
Public methodGetHashCode
Calculates hash code for this object.
(Overrides ObjectGetHashCode.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)

ExpandedRemarks

You do not create objects of this class. List level objects are created automatically when a list is created. You access ListLevel objects via the ListLevelCollection collection.

Use the properties of ListLevel to specify list formatting for individual list levels.

ExpandedExamples

Shows how to apply custom list formatting to paragraphs when using DocumentBuilder.
Document doc = new Document();

// Create a list based on one of the Microsoft Word list templates
List list = doc.Lists.Add(ListTemplate.NumberDefault);

// Completely customize one list level
ListLevel listLevel = list.ListLevels[0];
listLevel.Font.Color = Color.Red;
listLevel.Font.Size = 24;
listLevel.NumberStyle = NumberStyle.OrdinalText;
listLevel.StartAt = 21;
listLevel.NumberFormat = "\x0000";

listLevel.NumberPosition = -36;
listLevel.TextPosition = 144;
listLevel.TabPosition = 144;

// Customize another list level
listLevel = list.ListLevels[1];
listLevel.Alignment = ListLevelAlignment.Right;
listLevel.NumberStyle = NumberStyle.Bullet;
listLevel.Font.Name = "Wingdings";
listLevel.Font.Color = Color.Blue;
listLevel.Font.Size = 24;
listLevel.NumberFormat = "\xf0af"; // A bullet that looks like a star
listLevel.TrailingCharacter = ListTrailingCharacter.Space;
listLevel.NumberPosition = 144;

// Now add some text that uses the list that we created
// It does not matter when to customize the list - before or after adding the paragraphs
DocumentBuilder builder = new DocumentBuilder(doc);

builder.ListFormat.List = list;
builder.Writeln("The quick brown fox...");
builder.Writeln("The quick brown fox...");

builder.ListFormat.ListIndent();
builder.Writeln("jumped over the lazy dog.");
builder.Writeln("jumped over the lazy dog.");

builder.ListFormat.ListOutdent();
builder.Writeln("The quick brown fox...");

builder.ListFormat.RemoveNumbers();

builder.Document.Save(ArtifactsDir + "Lists.CreateCustomList.docx");

ExpandedSee Also