Example:
'Loads the Word Document
Dim document As New WordDocument(filename)
'Find the <<TempPlaceHolderForHTML>> text
Dim selections As TextSelection() = document.FindAll(New System.Text.RegularExpressions.Regex("<<TempPlaceHolderForHTML>>"))
For selectionIndex As Integer = 0 To selections.Length - 1
Dim selection As TextSelection = selections(selectionIndex)
Dim OwnerParagraph As WParagraph = selection.GetAsOneRange().OwnerParagraph
'Retrieve the Owner cell
If TypeOf OwnerParagraph.OwnerTextBody Is WTableCell Then
Dim cell As WTableCell = TryCast(OwnerParagraph.OwnerTextBody, WTableCell)
'Clear the paragraphs inside the cell
cell.ChildEntities.Clear()
Dim paragraph As IWParagraph = cell.AddParagraph()
'Append the HTML string to the paragraph
paragraph.AppendHTML(htmlstring)
End If
Next
'Saves the Word document to disk
document.Save("Sample.docx")
Kindly refer the below UG documentation link to get more information about Find and Replace:
UGLink:
http://help.syncfusion.com/ug/aspnetmvc/Documents/findandreplace.htm
Please let us know if you have any other questions.
Regards,
Divyalakshmi V
Hi IC,
Thank you for your update.
We have prepared a sample to find and replace the particular content with html string using find and replace functionality of DocIO. Please find the sample from below link
Sample link:
http://www.syncfusion.com/downloads/support/forum/120062/ze/Sample-1088296552
Please let us know if you have any other questions.
Regards,
Siva.