Smart Tags

With I have each node from the section, and I need to get the font of each to save it in a XML, but when the node is a Smart Tag (Node Type 21), I can get this, so I cant get the font properties of this node, how can I get this properties??

Hi Alex,


Thanks for your inquiry. Please note that, all text of the document is stored in runs of text. This is also true for SmartTag nodes i.e. text inside a SmartTag node is comprised of Run nodes. You can then simply iterate through the Run nodes and get the font objects as follows:

foreach (Run r in smartTag.GetChildNodes(NodeType.Run,
true))
{
Aspose.Words.Font f = r.Font;
}

I hope, this will help.

Best Regards,

Hi there,


Thanks for your inquiry.

What Awais has suggested is 100% correct. Just to clarify, a SmartTag is a wrapper for the text so even though it appears in the document body, it does not have any font. You simply need to copy the font of the runs.

Thanks,