Method FormatStyle
FormatStyle(WordDocument, DocumentPosition, string, Action<Style>)
Changes a style's definition, Modify Style: change runs on a copy that replaces the style.
Direct formatting in the document is not touched. A paragraph style's run formatting is copied to its linked
character style, and a character style's to its linked paragraph style.
public static DocumentEdit FormatStyle(this WordDocument document, DocumentPosition at, string styleId, Action<Style> change)
Parameters
documentWordDocumentThe document.
atDocumentPositionstyleIdstringThe style's id.
changeAction<Style>Changes the copy. Its id and type cannot change.
Returns
- DocumentEdit
The edit; every body, header and footer paragraph is reported changed.
Exceptions
- ArgumentNullException
document,styleIdorchangeis null.- ArgumentException
The position is not in the document, or no style has the id.