BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi Chiara,
Thank you for contacting Syncfusion product,
Instead of using your code snippet for removing the content from the text selection please use the below code snippet for removing the text section from the document.
Code Snippet:
'Gets start selection text
Dim startselection As TextSelection = wordDoc.Find("{SE}", True, True)
'Gets end selection text
Dim endselection As TextSelection = wordDoc.Find("{FINE_SE}", True, True)
'Gets the textrange from the start selection
Dim startparaitem As WTextRange = startselection.GetAsOneRange()
'Gets the textrange from the end selection
Dim endparaitem As WTextRange = endselection.GetAsOneRange()
'Gets the owner paragraph from the start selection
Dim startpara As WParagraph = startselection.GetAsOneRange().OwnerParagraph
'Gets the owner paragraph from the end selection
Dim endpara As WParagraph = endselection.GetAsOneRange().OwnerParagraph
Dim name As String = "BKM_DEL"
'Create bookmark start
Dim bookstart As New Syncfusion.DocIO.DLS.BookmarkStart(wordDoc, Name)
'Create bookmark end
Dim bookend As New Syncfusion.DocIO.DLS.BookmarkEnd(wordDoc, Name)
'Insert the startbookmark
startpara.Items.Insert(startpara.Items.IndexOf(startparaitem), bookstart)
'Insert the endbookmark
endpara.Items.Insert(endpara.Items.IndexOf(endparaitem) + 1, bookend)
Dim nav As New BookmarksNavigator(wordDoc)
'Navigate the bookmark
nav.MoveToBookmark(name)
'Remove the bookmark content
nav.DeleteBookmarkContent(False)
Regards,
Narendran