API Reference
WordList
Represents a collection of paragraphs formatted as a list and exposes methods to manipulate the list's numbering and style.
Inheritance
- WordElement
- WordList
Usage
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by
- Method WordDocument.AddCustomBulletList
- Method WordDocument.AddCustomBulletList
- Method WordDocument.AddCustomBulletList
- Method WordDocument.AddCustomList
- Method WordDocument.AddList
- Method WordDocument.AddListBulleted
- Method WordDocument.AddListNumbered
- Method WordDocument.AddPictureBulletList
- Method WordDocument.AddPictureBulletList
- Method WordDocument.AddTableOfContentList
- Property WordDocument.Lists
- Method WordFooter.AddList
- Method WordHeader.AddList
- Method WordHeaderFooter.AddList
- Method WordList.AddCustomBulletList
- Method WordList.AddCustomBulletList
- Method WordList.AddCustomBulletList
- Method WordList.AddCustomList
- Method WordList.AddListLevel
- Method WordList.AddListLevel
- Method WordList.AddListLevel
- Method WordList.AddPictureBulletList
- Method WordList.AddPictureBulletList
- Method WordList.Clone
- Method WordList.Clone
- Method WordParagraph.AddList
- Property WordSection.Lists
- Method WordTableCell.AddList
Accepted by parameters
- Method WordList.Merge
Constructors
public WordList(WordDocument wordDocument, Boolean isToc = false) #Initializes a new instance of the WordList class.
Parameters
- wordDocument OfficeIMO.Word.WordDocument
- The Word document.
- isToc System.Boolean = false
- Indicates if the list should be treated as a TOC.
public WordList(WordDocument wordDocument, WordParagraph paragraph, Boolean isToc = false) #Initializes a new instance of the WordList class with a starting paragraph.
Parameters
- wordDocument OfficeIMO.Word.WordDocument
- The Word document.
- paragraph OfficeIMO.Word.WordParagraph
- The starting paragraph.
- isToc System.Boolean = false
- Indicates if the list should be treated as a TOC.
Methods
public static WordList AddCustomBulletList(WordDocument document, Char symbol, String fontName, String colorHex, Nullable<Int32> fontSize = null) #WordListCreates a bulleted list using a custom symbol and formatting.
Parameters
- document OfficeIMO.Word.WordDocument
- The parent document.
- symbol System.Char
- The character to use as the bullet symbol.
- fontName System.String
- Font name used for the bullet symbol.
- colorHex System.String
- Optional hexadecimal color for the symbol.
- fontSize System.Nullable{System.Int32} = null
- Optional font size for the symbol in points.
Returns
The created WordList.
public static WordList AddCustomBulletList(WordDocument document, WordBulletSymbol symbol, String fontName, Nullable<OfficeColor> color = null, String colorHex = null, Nullable<Int32> fontSize = null) #WordListCreates a custom bulleted list using a predefined WordBulletSymbol.
Parameters
- document OfficeIMO.Word.WordDocument
- The parent document.
- symbol OfficeIMO.Word.WordBulletSymbol
- Predefined bullet symbol to use.
- fontName System.String
- Font name used for the symbol.
- color System.Nullable{OfficeIMO.Drawing.OfficeColor} = null
- Optional OfficeColor for the symbol.
- colorHex System.String = null
- Optional color specified as hex string. Ignored when color is provided.
- fontSize System.Nullable{System.Int32} = null
- Optional font size in points.
Returns
The created WordList.
public static WordList AddCustomBulletList(WordDocument document, WordListLevelKind kind, String fontName, Nullable<OfficeColor> color = null, String colorHex = null, Nullable<Int32> fontSize = null) #WordListCreates a bulleted list using one of the predefined WordListLevelKind values.
Parameters
- document OfficeIMO.Word.WordDocument
- The parent document.
- kind OfficeIMO.Word.WordListLevelKind
- Determines which bullet symbol to use.
- fontName System.String
- Font name used for the symbol.
- color System.Nullable{OfficeIMO.Drawing.OfficeColor} = null
- Optional symbol color.
- colorHex System.String = null
- Optional color specified as hex string. Ignored when color is provided.
- fontSize System.Nullable{System.Int32} = null
- Optional font size in points.
Returns
The created WordList.
public static WordList AddCustomList(WordDocument document) #WordListCreates a list that does not contain any predefined levels. Levels can be configured manually after creation.
Parameters
- document OfficeIMO.Word.WordDocument
- Parent document where the list will be added.
Returns
The created WordList.
public WordParagraph AddItem(WordParagraph wordParagraph, Int32 level = 0) #WordParagraphAdds a new empty item to the list.
Parameters
- wordParagraph OfficeIMO.Word.WordParagraph
- The paragraph after which the item should be inserted. If null the item is appended at the default position.
- level System.Int32 = 0
- The zero-based list level for the new item.
Returns
The newly created WordParagraph representing the list item.
public WordParagraph AddItem(String text, Int32 level = 0, WordParagraph wordParagraph = null) #WordParagraphAdds a new item to the list and optionally sets its text.
Parameters
- text System.String
- Text to assign to the new list item. Pass null to insert an empty item.
- level System.Int32 = 0
- The zero-based list level for the item.
- wordParagraph OfficeIMO.Word.WordParagraph = null
- The paragraph after which the item is inserted. When null the item is appended in the default position.
Returns
The WordParagraph representing the created list item.
public WordList AddListLevel(Int32 levelIndex, Char symbol, String fontName, String colorHex, Nullable<Int32> fontSize = null) #WordListAdds a new bullet list level using a custom symbol character.
Parameters
- levelIndex System.Int32
- Index of the level starting from 1.
- symbol System.Char
- Character used for the bullet.
- fontName System.String
- Font name used for the symbol.
- colorHex System.String
- Bullet color specified as hex string.
- fontSize System.Nullable{System.Int32} = null
- Optional font size in points.
Returns
The current WordList.
public WordList AddListLevel(Int32 levelIndex, WordBulletSymbol symbol, String fontName, Nullable<OfficeColor> color = null, String colorHex = null, Nullable<Int32> fontSize = null) #WordListAdds a new bullet list level using a predefined WordBulletSymbol.
Parameters
- levelIndex System.Int32
- Index of the level starting from 1.
- symbol OfficeIMO.Word.WordBulletSymbol
- Predefined bullet symbol.
- fontName System.String
- Font name used for the symbol.
- color System.Nullable{OfficeIMO.Drawing.OfficeColor} = null
- Optional symbol color.
- colorHex System.String = null
- Optional color specified as hex string. Ignored when color is provided.
- fontSize System.Nullable{System.Int32} = null
- Optional font size in points.
Returns
The current WordList.
public WordList AddListLevel(Int32 levelIndex, WordListLevelKind kind, String fontName, Nullable<OfficeColor> color = null, String colorHex = null, Nullable<Int32> fontSize = null) #WordListAdds a new bullet list level using one of the predefined WordListLevelKind values.
Parameters
- levelIndex System.Int32
- Index of the level starting from 1.
- kind OfficeIMO.Word.WordListLevelKind
- Determines which bullet symbol to use.
- fontName System.String
- Font name used for the symbol.
- color System.Nullable{OfficeIMO.Drawing.OfficeColor} = null
- Optional symbol color.
- colorHex System.String = null
- Optional color specified as hex string. Ignored when color is provided.
- fontSize System.Nullable{System.Int32} = null
- Optional font size in points.
Returns
The current WordList.
Examples
WordList list = document.AddCustomList()
.AddListLevel(1, WordListLevelKind.BulletSquareSymbol, "Courier New", colorHex: "#FF0000", fontSize: 14)
.AddListLevel(2, WordListLevelKind.BulletBlackCircle, "Arial", colorHex: "#00FF00", fontSize: 10);
list.AddItem("Top level");
list.AddItem("Nested level", 1);
public static WordList AddPictureBulletList(WordDocument document, Stream imageStream, String fileName) #WordListCreates a custom bullet list using an image as the bullet symbol.
Parameters
- document OfficeIMO.Word.WordDocument
- Parent document where the list will be added.
- imageStream System.IO.Stream
- Stream containing the image data.
- fileName System.String
- File name used to determine the image type.
Returns
The created WordList.
public static WordList AddPictureBulletList(WordDocument document, String imagePath) #WordListCreates a custom bullet list using an image file as the bullet symbol.
Parameters
- document OfficeIMO.Word.WordDocument
- Parent document where the list will be added.
- imagePath System.String
- Path to the image file.
Returns
The created WordList.
public WordList Clone() #WordListCreates a copy of this list after the last item.
Returns
The newly created WordList.
Exceptions
InvalidOperationException– Thrown when the list contains no items.
public WordList Clone(WordParagraph paragraph, Boolean after = true) #WordListClones this list and inserts it relative to the provided paragraph.
Parameters
- paragraph OfficeIMO.Word.WordParagraph
- The reference paragraph used for insertion.
- after System.Boolean = true
- If set to true the clone is inserted after the reference paragraph; otherwise it is inserted before.
Returns
The cloned WordList.
public Void ConvertToBulleted() #VoidConverts this list to a bulleted style while preserving existing list items.
public Void ConvertToNumbered() #VoidConverts this list to a numbered style while preserving existing list items.
public Void Merge(WordList documentList) #VoidMerges another list into this list.
Parameters
- documentList OfficeIMO.Word.WordList
- The list whose items should be moved into this instance.
public Void SetStartNumberingValue(Int32 value, Int32 level = 0) #VoidSets the starting number for the specified list level. Updates both the abstract definition and the list instance override.
Parameters
- value System.Int32
- Starting number for the level.
- level System.Int32 = 0
- Zero-based list level.
Examples
WordList list = document.AddCustomList();
list.Numbering.AddLevel(new WordListLevel(WordListLevelKind.Decimal));
list.SetStartNumberingValue(3);
list.AddItem("Starts at three");
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public Boolean IsToc { get; } #Indicates whether the list is treated as a Table of Contents (TOC).
public List<WordParagraph> ListItems { get; } #Gets all the list items associated with this WordList.
public Boolean RestartNumberingAfterBreak { get; set; } #Restarts numbering of a list after a break. Requires a list to be set to RestartNumbering overall.
public WordListNumbering Numbering { get; } #Exposes the numbering properties of the list, allowing for customization.
public Boolean Bold { get; set; } #Gets or sets a value indicating whether the numbering symbols are bold.
public Nullable<Int32> FontSize { get; set; } #Gets or sets the font size of the numbering symbols in points.
public Nullable<OfficeColor> Color { get; set; } #Gets or sets the color of the numbering symbols.
public String ColorHex { get; set; } #Gets or sets the hexadecimal color value of the numbering symbols.
public Boolean Italic { get; set; } #Gets or sets a value indicating whether the numbering symbols are italicized.
public Nullable<WordUnderlineStyle> Underline { get; set; } #Gets or sets the underline style of the numbering symbols.
public Boolean Strike { get; set; } #Gets or sets a value indicating whether the numbering symbols have a strikethrough.
public Boolean DoubleStrike { get; set; } #Gets or sets a value indicating whether the numbering symbols have a double strikethrough.
public String FontName { get; set; } #Gets or sets the font name of the numbering symbols.
public WordListStyle Style { get; } #Gets the list style or Custom when the list does not match a built-in style.