Table of Contents

Method SetStyleList

Namespace
DocWright.Dom.Editing
Assembly
DocWright.Dom.dll

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

document WordDocument

The document.

at DocumentPosition

Where the caret is: the edit's Before and After.

styleId string

A paragraph style's id.

template ListTemplate

The 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

document or styleId is null.

ArgumentException

The position is not in the document, or the id names no paragraph style.