Method ReplaceWithText
ReplaceWithText(string, CharacterFormat?)
Replaces the whole field — markup, instruction and result — with literal text.
public TextRun? ReplaceWithText(string text, CharacterFormat? format = null)
Parameters
textstringThe replacement text. An empty string removes the field outright.
formatCharacterFormatThe formatting for the replacement, or null to inherit ResultFormat.
Returns
- TextRun
The inserted run, or null when
textwas empty.
Exceptions
- ArgumentNullException
textis null.- InvalidOperationException
The region has already been edited away.