How can I determine if I've reached the bottom of a Slide?

I am adding text to a textframe using the add paragraphs. I also allow the text to wrap so it will not run off the side of the slide.

I need a way to determine if the textframe is about to run off the bottom of the slide. Is there a way to do this so I can add a new slide and continue?

Use this condition

If(tf.Y + tf.Height > presentation.SlideSize.Height)
    //move to next slide

I did try the Height property but it returns the value I set in the addRectangle Function

sComment = s.Shapes.AddRectangle(85, 470, 1, 1)

So in this example it keeps returning the 1 I set here and does not appear to be dynamic as I add Paragraphs.

Dear syrik,

To dynamically change the height of text frame, you should set its FitShapeToText property true. For example, here is a sample code that illustrates my point. It shows the height of textframe before and after setting the property true.

void AddTextFrame()
{
    Presentation pres = new Presentation();

    Aspose.Slides.Rectangle rect = pres.GetSlideByPosition(1).Shapes.AddRectangle(500, 1000, 3000, 1);
    rect.LineFormat.ShowLines = false;
    rect.AddTextFrame("This is some text. This is some text. This is some text. This is some text. This is some text.");

    TextFrame tf = rect.TextFrame;
    tf.WrapText = true;
    Console.WriteLine("[TextFrame Height]=" + tf.Height);

    tf.FitShapeToText = true;
    Console.WriteLine("[TextFrame Height]=" + tf.Height);

    pres.Write("outAddTextFrame.ppt");
}

Hi,

That is how i'm doing it as well but the height returns what is set for the rectangle so in this example it returns 3000. It doesn't seem to evaluate the actual textframe height.

The only difference is i'm using VB and you are using C#. Could this be causing the difference?

Thanks for the help,

Syrik

Dear Syrik,

My code does not return 3000 as a heigh of text frame. The actual output of my code is this.

Output

[TextFrame Height]=1
[TextFrame Height]=578

As you can see, first the height was 1, after setting the tf.FitShapeToText = true it returns the new height 578