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

Free Support Forum - aspose.com

Find string


I want to find strings in a word document like <@......> and list them a popup control.How can I do this?


Our customer will put , following tags to our document.

<@Product Code>

<@Product Name>

Then will find all of them.After finding I will list them on a pop up control like Product Code,Product Name

It is very important for me.Colud you please reply?

Hi Ahmet,

Thanks for your query. Yes, you can achieve your requirement by implementing IReplacingCallback interface. Please use the same approach shared at following documentation link to find tags like <@Product Code> and <@Product Name>.

Please also read the following ariticle about 'Find and Replace' and check following code snippet for your kind refernece.

Document doc = new Document(MyDir + "in.docx");

DocumentBuilder builder = new DocumentBuilder(doc);

Regex regex = new Regex("\\<@", RegexOptions.IgnoreCase);

FindEval obj = new FindEval();

doc.Range.Replace(regex, obj, true);

foreach (Run run in obj.nodes)




public class FindEval : IReplacingCallback


//Store Matched nodes

public ArrayList nodes = new ArrayList();

ReplaceAction IReplacingCallback.Replacing(ReplacingArgs e)


// This is a Run node that contains either the beginning or the complete match.

Node currentNode = e.MatchNode;


return ReplaceAction.Skip;



Hope this helps you. Please let us know if you have any more queries.

Ok.Thank you…