Converting range.replace methods from older to newer format

Hi ,
We are doing migration from older to newer Aspose library and facing issues related replace text with image using asposeWord.

I’m below code to replace the text with barcode image in the older version of aspose:

asposeWordDoc.Range.Replace(new Regex(Regex.Escape(searchText), RegexOptions.IgnoreCase).ToString(), new ReplaceEvaluatorFindAndInsert(imageStream, imageWidth, imageHeight, replaceContentType));

But newer replace (version 20.3) has three parameters with replacement text as second parameter and third as FindReplaceOptions which has ReplaceEvaluatorFindAndInsert initialization.

asposeWordDoc.Range.Replace(new Regex(Regex.Escape(searchText), RegexOptions.IgnoreCase)," ", new FindReplaceOptions(
new ReplaceEvaluatorFindAndInsert(imageStream, imageWidth, imageHeight, replaceContentType)));

and not sure what to keep for replacement text as i’m replacement through option with image not text.
Please guide on this replace conversion

Thanks

@mani.g,

Yes, you can pass empty string in second replacement parameter like this:

FindReplaceOptions opts = new FindReplaceOptions();
opts.ReplacingCallback = new ReplaceEvaluatorFindAndInsert(imageStream, imageWidth, imageHeight, replaceContentType);
asposeWordDoc.Range.Replace(new Regex(Regex.Escape(searchText), RegexOptions.IgnoreCase),
                            "",
                            opts);

And in the ReplaceAction IReplacingCallback.Replacing(ReplacingArgs e) method, return ReplaceAction.Skip;

Hope, this helps.