- Home
- Forum
- ASP.NET MVC
- Need help with pasting HTML to Document
Need help with pasting HTML to Document
Thank you for your interest in Syncfusion products.
Kindly make use of below code snippet to meet your requirement by using Find and Replace functionality of DocIO .
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.
- 4 Replies
- 3 Participants
-
LC lc
- Aug 27, 2015 08:57 AM UTC
- Aug 31, 2015 07:22 AM UTC