Method ApplyCharacterStyle
ApplyCharacterStyle(WordDocument, DocumentSpan, string?)
Applies a character style to the content a span covers; direct formatting stays.
public static DocumentEdit ApplyCharacterStyle(this WordDocument document, DocumentSpan span, string? styleId)
Parameters
documentWordDocumentThe document that holds the span.
spanDocumentSpanThe span.
styleIdstringThe style id, or null to remove the character style.
Returns
- DocumentEdit
The edit.
Exceptions
- ArgumentNullException
documentis null.- ArgumentException
The span is not in
document, an end falls inside a surrogate pair, orstyleIdnames no character style of the document.- InvalidOperationException
An end is in a shape's text box.