Class MultiLevelTextList
Represents a multi-level text list within the document.
Implements
Inherited Members
Namespace: IronWord.Models
Assembly: IronWord.dll
Syntax
public class MultiLevelTextList : ParentElement
MultiLevelTextList builds the numbered or bulleted lists in a Word document, including outlines that nest several levels deep. It gathers the ListItem entries that make up the list and carries the formatting that decides whether they appear as numbers or bullets, how they are justified, and how far each level indents.
A developer assembles the list, then attaches it to a WordDocument with AddMultiLevelTextList; the document's MultiLevelTextLists property holds the lists already added, and Index reports a list's position among them. Entries come from ListItem objects, each built from a Paragraph, and a nested list lives beneath an item to form the next level. This is the type behind a checklist, a legal outline, or any ordered series in the body.
Add and remove entries with AddItem, RemoveItem, and Clear, all of which take a ListItem. Items exposes the current entries, so you can inspect or reorder them before the list is rendered. ListType selects numbering versus bullets, Justification aligns the text, and SymbolText with SymbolTextFontName set the bullet glyph and its font for a level. StartNumberingValue chooses the first number, useful when a list resumes counting from an earlier section, and NumberingId ties related lists together so they share one numbering sequence across breaks. Indentation is controlled in real units: SetStartIndentation and SetHangingIndentation take a value plus a MeasurementUnit, and the matching GetStartIndentation and GetHangingIndentation read them back in the unit you ask for. Build the entries before attaching the list so the numbering and indentation are settled when the document renders.
var list = new MultiLevelTextList();
list.AddItem(new ListItem(new Paragraph("First")));
list.AddItem(new ListItem(new Paragraph("Second")));
document.AddMultiLevelTextList(list);The add list example builds a numbered list, the add bullet list example demonstrates the bulleted form, and the document element tutorial shows how lists sit within a document.
Constructors
MultiLevelTextList()
Initializes a new instance of the MultiLevelTextList class.
Declaration
public MultiLevelTextList()
MultiLevelTextList(ListItem[])
Initializes a new instance of the MultiLevelTextList class with the specified ListItems as child elements.
Declaration
public MultiLevelTextList(params ListItem[] children)
Parameters
| Type | Name | Description |
|---|---|---|
| ListItem[] | children | The child elements to be added. |
Properties
HangingIndentation
Gets or sets the hanging indentation for a multilevel list.
Declaration
public double HangingIndentation { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
The indentation is measured in inches by default and converted to twips when accessed or modified.
Index
Gets the index of this MultiLevelTextList within the parent's list of children.
Declaration
public int Index { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Items
Gets the list of ListItem contained within this MultiLevelTextList.
Declaration
public List<ListItem> Items { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<ListItem> |
Justification
Gets or sets the justification for the text in a multilevel list.
Declaration
public JustificationValues Justification { get; set; }
Property Value
| Type | Description |
|---|---|
| IronSoftware.Abstractions.Word.JustificationValues |
ListType
Gets or sets the type of numbering or bullet for a multilevel list.
Declaration
public NumberFormatValues ListType { get; set; }
Property Value
| Type | Description |
|---|---|
| NumberFormatValues |
NumberingId
Declaration
protected int NumberingId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
StartIndentation
Gets or sets the starting indentation for a multilevel list.
Declaration
public double StartIndentation { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Remarks
The indentation is measured in inches by default and converted to twips when accessed or modified.
StartNumberingValue
Gets or sets the starting value for numbering in a multilevel list.
Declaration
public int StartNumberingValue { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
SymbolText
Gets or sets the SymbolText for a specific level in a multilevel list.
Declaration
public string SymbolText { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
The SymbolText property defines the format of the numbering or bullet text for a specific level in a multilevel list.
SymbolTextFontName
Gets or sets the SymbolText font for a specific level in a multilevel list.
Declaration
public string SymbolTextFontName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Remarks
The SymbolTextFontName property defines the SymbolText font for a specific level in a multilevel list.
Methods
AddItem(ListItem)
Adds a new ListItem to this MultiLevelTextList.
Declaration
public void AddItem(ListItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| ListItem | item |
Clear(ListItem)
Removes all ListItems from this MultiLevelTextList.
Declaration
public void Clear(ListItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| ListItem | item |
GetHangingIndentation(MeasurementUnit)
Gets the hanging indentation for a multilevel list.
Declaration
public double GetHangingIndentation(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The measurement unit for the indentation. Default is Twips. |
Returns
| Type | Description |
|---|---|
| System.Double | The hanging indentation value in the specified measurement unit. |
GetStartIndentation(MeasurementUnit)
Gets the starting indentation for a multilevel list.
Declaration
public double GetStartIndentation(MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| MeasurementUnit | measurementUnit | The measurement unit for the indentation. Default is Twips. |
Returns
| Type | Description |
|---|---|
| System.Double | The starting indentation value in the specified measurement unit. |
RemoveItem(ListItem)
Removes a ListItem from this MultiLevelTextList.
Declaration
public void RemoveItem(ListItem item)
Parameters
| Type | Name | Description |
|---|---|---|
| ListItem | item |
SetHangingIndentation(Double, MeasurementUnit)
Sets the hanging indentation for a multilevel list.
Declaration
public void SetHangingIndentation(double hangingIndentation, MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | hangingIndentation | The hanging indentation value. |
| MeasurementUnit | measurementUnit | The measurement unit for the indentation. Default is Twips. |
SetStartIndentation(Double, MeasurementUnit)
Sets the starting indentation for a multilevel list.
Declaration
public void SetStartIndentation(double startIndentation, MeasurementUnit measurementUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | startIndentation | The starting indentation value. |
| MeasurementUnit | measurementUnit | The measurement unit for the indentation. Default is Twips. |