Method UpdateStyleToMatch
UpdateStyleToMatch(WordDocument, DocumentSpan)
Update Style to Match Selection: the style of the span's first paragraph takes that paragraph's direct paragraph formatting and the direct run formatting at the span's start (the first character a selection covers; at a caret, the formatting typing there would get), and is then reapplied to every paragraph of the style (see the remarks on StyleDefinitionEditingExtensions). When that leaves the style as it was, nothing changes and the edit is empty.
public static DocumentEdit UpdateStyleToMatch(this WordDocument document, DocumentSpan span)
Parameters
documentWordDocumentThe document.
spanDocumentSpanThe selection, or a caret.
Returns
- DocumentEdit
The edit.
Exceptions
- ArgumentNullException
documentis null.- ArgumentException
The span is not in the document, or the paragraph's style is not defined.