Table of Contents

Method ApplyCharacterStyle

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

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

document WordDocument

The document that holds the span.

span DocumentSpan

The span.

styleId string

The style id, or null to remove the character style.

Returns

DocumentEdit

The edit.

Exceptions

ArgumentNullException

document is null.

ArgumentException

The span is not in document, an end falls inside a surrogate pair, or styleId names no character style of the document.

InvalidOperationException

An end is in a shape's text box.