I’m trying to create a rectangle with two lines of text, different styling on each line, and an extra amount of space between the lines.
I’ve followed this guide to get the rectangle + styling, but I’m not sure how to add the custom line spacing.
Working with Text|Documentation (aspose.com)
My code:
// Mark character run and add text
shape.Text.Value.Add(new Cp(0));
shape.Text.Value.Add(new Txt(“TextStyle_Regular\n”));
shape.Text.Value.Add(new Cp(1));
shape.Text.Value.Add(new Txt(“TextStyle_Bold_Italic\n”));
// Add formatting characters
shape.Chars.Add(new Aspose.Diagram.Char());
shape.Chars.Add(new Aspose.Diagram.Char());
// Set properties e.g. color, font, size and style etc.
shape.Chars[0].IX = 0;
shape.Chars[0].Style.Value = StyleValue.Undefined;
shape.Chars[1].IX = 1;
shape.Chars[1].Style.Value = StyleValue.Bold | StyleValue.Italic;
There doesn’t seem to be a property on Chars for line spacing, but there is a “SpAfter” property on Paras, which looks like it might be what I want. But my Paras collection is empty.
shape.Paras[0].SpAfter.Value = 0.2
What’s the best way of doing this?