Table of Contents

Method FormatText

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

FormatText(WordDocument, DocumentSpan, Action<CharacterFormat>)

Changes the character formatting of the content a span covers.

public static DocumentEdit FormatText(this WordDocument document, DocumentSpan span, Action<CharacterFormat> change)

Parameters

document WordDocument

The document that holds the span.

span DocumentSpan

The span.

change Action<CharacterFormat>

Changes a copy of each covered run's format bag: set a property to state it, set it to null to inherit it.

Returns

DocumentEdit

The edit; Before and After are the span's ends.

Exceptions

ArgumentNullException

document or change is null.

ArgumentException

The span is not in document, or an end falls inside a surrogate pair.

InvalidOperationException

An end is in a shape's text box, which a DOCX save writes from the shape's preserved drawing.