Justifying Text in Shape

Hi,

When I set text in a shape (such as 'Rectangle'), the text is center-justified by default.

How can I change it to left justified?

Thanks,

Steve

Hi Steve,

Please use the following code.

shape.Paras[0].HorzAlign.Value = HorzAlignValue.LeftAlign;

Best Regards,

Muhammad,

Thanks for your reply.

I added the code, but it returned an error. As I only set the text value for a shape, there wasn't paras[0] for the shape:

shape.Text.Value.Add(New Aspose.Diagram.Txt(sText))

If I need to use 'paras', could you please give me a code snippet to do this?

Thanks,

Steve

Hi Steve,

You can use the following code.

Para para = new Para();
para.IX = shape.Paras.Add(para);
para.HorzAlign.Value = HorzAlignValue.LeftAlign;
shape.Text.Value.Add(new Txt("Text1"));

Best Regards,