Version

InsertText(Int32,String,String,CharacterSettings,String,Boolean) Method

Inserts the specified text in the document at the specified document offset. If the document offset refers to a block node, it finds an appropriate text node inside the block node to add the text to. If a text node is not found, it will add one to ensure the text gets inserted at a location that would be considered 'intended' within the block node.
Syntax
'Declaration
 
Public Sub InsertText( _
   ByVal documentOffset As Integer, _
   ByVal text As String, _
   ByRef error As String, _
   Optional ByVal characterSettings As CharacterSettings, _
   Optional ByVal runStyleId As String, _
   Optional ByVal mergeWithExistingSettings As Boolean _
) 
public void InsertText( 
   int documentOffset,
   string text,
   out string error,
   CharacterSettings characterSettings,
   string runStyleId,
   bool mergeWithExistingSettings
)

Parameters

documentOffset
Document offset at which to insert the text.
text
Text to be inserted. If text is null or empty then this method does nothing.
error
If there's an error, this out parameter is set to the error information.
characterSettings
Optional parameter. Character settings to apply to the text. If null and mergeWithExistingSettings is true then the inserted text will pick up the settings of the paragraph content before (or after if no paragraph content before) the specified offset. If non-null and mergeWithExistingSettings is true then settings from this settings object will be merged with the settings from the previous content and the merged settings will be applied to the inserted text. If mergeWithExistingSettings is false then these settings will be applied as they are without merging, even in the case where characterSettings is null in which case any explicit settings from the previous content will not be applied to the new content.
runStyleId
Optional parameter. Run style to apply to the text. If null and mergeWithExistingSettings is true then the inserted text will pick up the style of the paragraph content before the specified offset.
mergeWithExistingSettings
Indicates whether to use any explicit character settings and run style from the paragraph content before (or after if no paragraph content before) the specified offset.
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also