We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Hyperlink lost in comment after comment text update

Hi Aspose team,

by using this simple code:

Dim oldText As String
Dim newText As String

dim

officeDocument = New Document(path)


Dim comments As NodeCollection = officeDocument.GetChildNodes(NodeType.Comment, True)


For Each comm As Comment In comments
oldText = comm.ToString(SaveFormat.Text)
newText = oldText.Replace("comment", "aspose")

If oldText <> newText Then
comm.SetText(newText)
End If
Next

I am replacing text in document comments.
If comment text with hyperlink is updated then hyperlink is lost.

Please see attached document and try to replace "comment" to anything to see what I mean.

Any way to preserve hyperlink when comment text is changed?

Thanks,
Oliver
Found solution by using Runs.
Please close this ticket.

Hi Oliver,

Thanks for your inquiry. It is nice to hear from you that you have found the solution of your query. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.