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

Free Support Forum - aspose.com

Replace Text to Hyperlink

I use aspose C#
I need search and replace text in docx by aspose.
I need find text by regular expression and add to this text hyperlink.
I use IReplacingCallback
My code :
public ReplaceAction Replacing(ReplacingArgs args)
DocumentBuilder bl = new DocumentBuilder((Document)args.MatchNode.Document);
bl.InsertHyperlink(args.Match.Groups[0].Value, “sl:” + args.Match.Groups[0].Value, false);
return ReplaceAction.Replace;


My regular expression :
string regex = @“19|20[0-9][0-9]”;

I need change all years in text to hyprlink .

This doesn’t work on text like
In this years: 2017, 2016, 2015, 2014


Thanks for your inquiry. We will appreciate it if you please share your sample input, output and expected document here. You can ZIP and attached the documents to the post. It will help us to test your scenario exactly and address it accordingly.