Table of Contents

Method FormatStyle

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

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

document WordDocument

The document.

at DocumentPosition

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

styleId string

The style's id.

change Action<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, styleId or change is null.

ArgumentException

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