Method SetStyleList
SetStyleList(WordDocument, DocumentPosition, string, ListTemplate?)
Modify Style > Format > Numbering (WQ-0120): a paragraph style gets a new list made from a template, as
Word writes it: the style's w:numPr names the list (no w:ilvl: level 0) and the list's first
level names the style (w:pStyle), so every paragraph of the style is numbered. A null template is
None: the style states no list (w:numId="0" where a base style has one). Direct formatting stays.
public static DocumentEdit SetStyleList(this WordDocument document, DocumentPosition at, string styleId, ListTemplate? template)
Parameters
documentWordDocumentThe document.
atDocumentPositionstyleIdstringA paragraph style's id.
templateListTemplateThe list's definition (Word's galleries: ListLibrary), or null for none.
Returns
- DocumentEdit
The edit; undoing it also removes the list it added.
Exceptions
- ArgumentNullException
documentorstyleIdis null.- ArgumentException
The position is not in the document, or the id names no paragraph style.