Syncfusion.DocIO.Base
Example 


The string that represents the text to be inserted.
True if it is save formatting, otherwise false.

InsertText(String,Boolean) Method

Inserts the specified text to current bookmark along with its formatting.
Syntax
'Declaration
 
Public Overloads Function InsertText( _
   ByVal text As String, _
   ByVal saveFormatting As Boolean _
) As IWTextRange
'Usage
 
Dim instance As BookmarksNavigator
Dim text As String
Dim saveFormatting As Boolean
Dim value As IWTextRange
 
value = instance.InsertText(text, saveFormatting)
public IWTextRange InsertText( 
   string text,
   bool saveFormatting
)

Parameters

text
The string that represents the text to be inserted.
saveFormatting
True if it is save formatting, otherwise false.

Return Value

The IWTextRange object that represents the inserted text.
Example
This example shows how to insert a simple text along with its formatting using BookmarkNavigator.
private void Button1_Click(System.Object sender, System.EventArgs e)
{
    WordDocument document = new WordDocument("Bookmarks.docx", FormatType.Docx);
    //Create the bookmark navigator instance to access the bookmark
    BookmarksNavigator bookmarkNavigator = new BookmarksNavigator(document);
    //Move the virtual cursor to the before the end location of the bookmark "Northwind"
    bookmarkNavigator.MoveToBookmark("Northwind");
    //Insert a new text before the bookmark end of the bookmark
    bookmarkNavigator.InsertText(" Northwind Database is a set of tables containing data fitted into predefined categories.", true);
    document.Save("Result.docx", FormatType.Docx);
    document.Close();
}
Private Sub button_Click(sender As Object, e As EventArgs)
    Dim document As New WordDocument("Bookmarks.docx", FormatType.Docx)
    'Create the bookmark navigator instance to access the bookmark
    Dim bookmarkNavigator As New BookmarksNavigator(document)
    'Move the virtual cursor to the before the end location of the bookmark "Northwind"
    bookmarkNavigator.MoveToBookmark("Northwind")
    'Insert a new text before the bookmark end of the bookmark
    bookmarkNavigator.InsertText(" Northwind Database is a set of tables containing data fitted into predefined categories.", True)
    document.Save("Result.docx", FormatType.Docx)
    document.Close()
End Sub
AssemblyVersion

Syncfusion.DocIO.Base: 17.1460.0.47

See Also