Method FormatText
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
documentWordDocumentThe document that holds the span.
spanDocumentSpanThe span.
changeAction<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
Exceptions
- ArgumentNullException
documentorchangeis 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.