Hello.
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.MoveTo(args.MatchNode);
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