Draw a line at baseline of a textframe

Hi,

Suppose there is a paragraph in a TextFrame which WrapText is ‘false’. The paragraph has some portions with different font height.

How can I draw a line at baseline of the paragraph (like underline) ?

Thanks

There is no exact way.

However, you can draw a line with Slide.Shapes.AddLine() method. To get the x1, y1 and x2, y2 coordinates, you can make use of TextFrame.X, TextFrame.Y, TextFrame.Width and TextFrame.Height properties.

e.g

int X1 = tf.X;
int X2 = tf.X + tf.Width;
int Y1 = tf.Y + tf.Height;
int Y2 = Y1;

Point startPoint = new Point(X1, Y1);
Point endPoint = new Point(X2, Y2);

slide1.Shapes.AddLine(startPoint, endPoint);

If you want to underline the text then you can set the Portion.UnderLine property true of all the portion objects inside the paragraph

Thanks for your reply.
But your tip does not help me a lot. What I want is to place a picture at any position in a text line, and bottom of the picture must be same with baseline of the text line.

The main task is the position of baseline of a TextFrame.

Help help…

Thanks

phucbui:

But your tip does not help me a lot. What I want is to place a picture at any position in a text line, and bottom of the picture must be same with baseline of the text line.

Can you please show me some sample ppt with such an output? I would try to think over some workaround. However, to draw a line at the baseline of text is not supported by Aspose.Slides and also by PowerPoint.

Hi,

I attach a ppt example.
What I want is to place picture at baseline of existing textbox. How to know position of the baseline?

Thanks

It is not possible with Aspose.Slides. But I think, for this purpose, you can make use of Font and Graphics namespaces and classes in .<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />NET.