Free Support Forum -

Getting Font Style/Family for a shape

Hi, I need to know how I can get a font style for a shape. Like a text shape. Thanks. Anthony

Hi Anthony,

Thank you for your inquiry. I would like to update you that the Shape element contains an element called Text, which contains the characters of the text and special elements (cp, pp, tp, and fld) that mark the end of one run and the beginning of the next. Char Element contains the formatting attributes for the shape’s text, such as font, color, text style, case, position relative to the baseline, and point size. You can get this information using following code snippet:

Diagram diagram = new

StyleSheet stylesheet = diagram.Pages[0].Shapes[2].TextStyle;

int IX = stylesheet.Chars[0].IX;

StyleValue styleValue = stylesheet.Chars[0].Style.Value;

int fontValue = stylesheet.Chars[0].Font.Value;

Double sizeValue = stylesheet.Chars[0].Size.Value;

string colorValue = stylesheet.Chars[0].Color.Value;

BOOL doubleLine = stylesheet.Chars[0].DblUnderline.Value;

BOOL doulestrike = stylesheet.Chars[0].DoubleStrikethrough.Value;

BOOL strike = stylesheet.Chars[0].Strikethru.Value;

Please let me know in case of further assistance and comments.