API Reference

Class

WordList

Namespace OfficeIMO.Word
Assembly OfficeIMO.Word

Represents a collection of paragraphs formatted as a list and exposes methods to manipulate the list's numbering and style.

Inheritance

Usage

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters

Constructors

WordList 4 overloads
public WordList(WordDocument wordDocument, Boolean isToc = false) #

Initializes a new instance of the WordList class.

Parameters

wordDocument OfficeIMO.Word.WordDocument requiredposition: 0
The Word document.
isToc System.Boolean = false optionalposition: 1
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 requiredposition: 0
The Word document.
paragraph OfficeIMO.Word.WordParagraph requiredposition: 1
The starting paragraph.
isToc System.Boolean = false optionalposition: 2
Indicates if the list should be treated as a TOC.
public WordList(WordDocument wordDocument, Int32 numberId) #

Initializes a new instance of the WordList class with a specific number ID.

Parameters

wordDocument OfficeIMO.Word.WordDocument requiredposition: 0
The Word document.
numberId System.Int32 requiredposition: 1
The numbering ID.
public WordList(WordDocument wordDocument, WordHeaderFooter headerFooter) #

Initializes a new instance of the WordList class for headers and footers.

Parameters

wordDocument OfficeIMO.Word.WordDocument requiredposition: 0
The Word document.
headerFooter OfficeIMO.Word.WordHeaderFooter requiredposition: 1
The header or footer.

Methods

AddCustomBulletList 3 overloads
public static WordList AddCustomBulletList(WordDocument document, Char symbol, String fontName, String colorHex, Nullable<Int32> fontSize = null) #
Returns: WordList

Creates a bulleted list using a custom symbol and formatting.

Parameters

document OfficeIMO.Word.WordDocument requiredposition: 0
The parent document.
symbol System.Char requiredposition: 1
The character to use as the bullet symbol.
fontName System.String requiredposition: 2
Font name used for the bullet symbol.
colorHex System.String requiredposition: 3
Optional hexadecimal color for the symbol.
fontSize System.Nullable{System.Int32} = null optionalposition: 4
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) #
Returns: WordList

Creates a custom bulleted list using a predefined WordBulletSymbol.

Parameters

document OfficeIMO.Word.WordDocument requiredposition: 0
The parent document.
symbol OfficeIMO.Word.WordBulletSymbol requiredposition: 1
Predefined bullet symbol to use.
fontName System.String requiredposition: 2
Font name used for the symbol.
color System.Nullable{OfficeIMO.Drawing.OfficeColor} = null optionalposition: 3
Optional OfficeColor for the symbol.
colorHex System.String = null optionalposition: 4
Optional color specified as hex string. Ignored when color is provided.
fontSize System.Nullable{System.Int32} = null optionalposition: 5
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) #
Returns: WordList

Creates a bulleted list using one of the predefined WordListLevelKind values.

Parameters

document OfficeIMO.Word.WordDocument requiredposition: 0
The parent document.
kind OfficeIMO.Word.WordListLevelKind requiredposition: 1
Determines which bullet symbol to use.
fontName System.String requiredposition: 2
Font name used for the symbol.
color System.Nullable{OfficeIMO.Drawing.OfficeColor} = null optionalposition: 3
Optional symbol color.
colorHex System.String = null optionalposition: 4
Optional color specified as hex string. Ignored when color is provided.
fontSize System.Nullable{System.Int32} = null optionalposition: 5
Optional font size in points.

Returns

The created WordList.

public static WordList AddCustomList(WordDocument document) #
Returns: WordList

Creates a list that does not contain any predefined levels. Levels can be configured manually after creation.

Parameters

document OfficeIMO.Word.WordDocument requiredposition: 0
Parent document where the list will be added.

Returns

The created WordList.

AddItem 2 overloads
public WordParagraph AddItem(WordParagraph wordParagraph, Int32 level = 0) #
Returns: WordParagraph

Adds a new empty item to the list.

Parameters

wordParagraph OfficeIMO.Word.WordParagraph requiredposition: 0
The paragraph after which the item should be inserted. If null the item is appended at the default position.
level System.Int32 = 0 optionalposition: 1
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) #
Returns: WordParagraph

Adds a new item to the list and optionally sets its text.

Parameters

text System.String requiredposition: 0
Text to assign to the new list item. Pass null to insert an empty item.
level System.Int32 = 0 optionalposition: 1
The zero-based list level for the item.
wordParagraph OfficeIMO.Word.WordParagraph = null optionalposition: 2
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.

AddListLevel 3 overloads
public WordList AddListLevel(Int32 levelIndex, Char symbol, String fontName, String colorHex, Nullable<Int32> fontSize = null) #
Returns: WordList

Adds a new bullet list level using a custom symbol character.

Parameters

levelIndex System.Int32 requiredposition: 0
Index of the level starting from 1.
symbol System.Char requiredposition: 1
Character used for the bullet.
fontName System.String requiredposition: 2
Font name used for the symbol.
colorHex System.String requiredposition: 3
Bullet color specified as hex string.
fontSize System.Nullable{System.Int32} = null optionalposition: 4
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) #
Returns: WordList

Adds a new bullet list level using a predefined WordBulletSymbol.

Parameters

levelIndex System.Int32 requiredposition: 0
Index of the level starting from 1.
symbol OfficeIMO.Word.WordBulletSymbol requiredposition: 1
Predefined bullet symbol.
fontName System.String requiredposition: 2
Font name used for the symbol.
color System.Nullable{OfficeIMO.Drawing.OfficeColor} = null optionalposition: 3
Optional symbol color.
colorHex System.String = null optionalposition: 4
Optional color specified as hex string. Ignored when color is provided.
fontSize System.Nullable{System.Int32} = null optionalposition: 5
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) #
Returns: WordList

Adds a new bullet list level using one of the predefined WordListLevelKind values.

Parameters

levelIndex System.Int32 requiredposition: 0
Index of the level starting from 1.
kind OfficeIMO.Word.WordListLevelKind requiredposition: 1
Determines which bullet symbol to use.
fontName System.String requiredposition: 2
Font name used for the symbol.
color System.Nullable{OfficeIMO.Drawing.OfficeColor} = null optionalposition: 3
Optional symbol color.
colorHex System.String = null optionalposition: 4
Optional color specified as hex string. Ignored when color is provided.
fontSize System.Nullable{System.Int32} = null optionalposition: 5
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);
                
AddPictureBulletList 2 overloads
public static WordList AddPictureBulletList(WordDocument document, Stream imageStream, String fileName) #
Returns: WordList

Creates a custom bullet list using an image as the bullet symbol.

Parameters

document OfficeIMO.Word.WordDocument requiredposition: 0
Parent document where the list will be added.
imageStream System.IO.Stream requiredposition: 1
Stream containing the image data.
fileName System.String requiredposition: 2
File name used to determine the image type.

Returns

The created WordList.

public static WordList AddPictureBulletList(WordDocument document, String imagePath) #
Returns: WordList

Creates a custom bullet list using an image file as the bullet symbol.

Parameters

document OfficeIMO.Word.WordDocument requiredposition: 0
Parent document where the list will be added.
imagePath System.String requiredposition: 1
Path to the image file.

Returns

The created WordList.

Clone 2 overloads
public WordList Clone() #
Returns: WordList

Creates 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) #
Returns: WordList

Clones this list and inserts it relative to the provided paragraph.

Parameters

paragraph OfficeIMO.Word.WordParagraph requiredposition: 0
The reference paragraph used for insertion.
after System.Boolean = true optionalposition: 1
If set to true the clone is inserted after the reference paragraph; otherwise it is inserted before.

Returns

The cloned WordList.

public Void ConvertToBulleted() #
Returns: Void

Converts this list to a bulleted style while preserving existing list items.

public Void ConvertToNumbered() #
Returns: Void

Converts this list to a numbered style while preserving existing list items.

public Void Merge(WordList documentList) #
Returns: Void

Merges another list into this list.

Parameters

documentList OfficeIMO.Word.WordList requiredposition: 0
The list whose items should be moved into this instance.
public Void Remove() #
Returns: Void

Removes the list from the document including all list items.

public Void SetStartNumberingValue(Int32 value, Int32 level = 0) #
Returns: Void

Sets the starting number for the specified list level. Updates both the abstract definition and the list instance override.

Parameters

value System.Int32 requiredposition: 0
Starting number for the level.
level System.Int32 = 0 optionalposition: 1
Zero-based list level.

Examples


WordList list = document.AddCustomList();
list.Numbering.AddLevel(new WordListLevel(WordListLevelKind.Decimal));
list.SetStartNumberingValue(3);
list.AddItem("Starts at three");
            

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.