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

Free Support Forum - aspose.com

Get font of a particular tag

We need to get the font name and the size of a particular tag that is matched successfully by the regex .

Example -

The Input document paragraph is given with the tag <> paragrapth font is times and the <> font name is Georgia , i need to find the token font name during replace process .

"Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. <> Nulla quis sem at

the replacing method we are using like -

AsposeDoc.Range.Replace(new System.Text.RegularExpressions.Regex(field.Tag),new BuildingBlockEvaluator(field.Tag, field.Sections), false);

Class that implement the IReplacingCallback interface -

public class BuildingBlockEvaluator : IReplacingCallback


ReplaceAction IReplacingCallback.Replacing(ReplacingArgs e) {

bb_element_full = e.Match.ToString();

Need font name of tag <> here that is given to document so that we replaced document font name and font size will remain same .


Hi Pankaj,

Thanks for your inquiry. In your case, I suggest you please use the Run.Font property. Please check the ReplacingArgs.MatchNode in following code example. Hope this helps you.

Please let us know if you have any more queries.

ReplaceAction IReplacingCallback.Replacing(ReplacingArgs e)


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

Node currentNode = e.MatchNode;


//Your code....

return ReplaceAction.Skip;