Free Support Forum - aspose.com

Search Aspose.Words.Document

Is it any way to search Aspose.Words.Document for a string? Let's say I need to do similar coding in Aspose.Words as in MS Word, is it possible? Thanks very much.

With objWord.ActiveDocument.Content.Find

.ClearFormatting()

.Text = "Can't open file"

.Forward = True

.Execute()

If .Found = True Then

convertHazard = ""

objWord.Documents.Close (SaveChanges:=Microsoft.Office.Interop.Word.WdSaveOptions.wdDoNotSaveChanges)

result = removeWord()

Exit Function

End If

End With

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. You can use Replace method to achieve this. Please see the following link for more information.

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/find-and-replace.html

I hope this could help you.

Best regards.