Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Thu Sep 22, 2016 5:12 am

I have one query about if in case of Text-box in Power Point Presentation slide, if Text is more then its go beyond slides apart from moving into next slide, so please consult with your technical team and reply me back as soon as possible.

I have used it with ASP.Net(C#) so if you have any specific solution to above problem in C#, So please provide any demo or web link to access the required code.

sachinnikam
 
Posts: 1
Joined: Mon Sep 19, 2016 6:26 am

Fri Sep 23, 2016 7:05 am

Hello,

Thanks for your inquiry. Every slides in PowerPoint is individual, so there is no automatic way to determine this. However, you can achieve the purpose on your end. What you need to do is that you check the shape height after you add text to textbox. If the Y-Position + height of shape is greater than slide height after adding text, then it means that text has spilled out of textbox.
And I have created a sample example that will help you in checking if the textbox overflows the slide when adding text or not.
Code: Select all
Presentation Pres = new Presentation();
Pres.LoadFromFile("test.pptx");
ISlide Slide = Pres.Slides[0];
foreach (IShape Shape in Slide.Shapes)
            {
                if ((Shape as IAutoShape).ShapeType == ShapeType.Rectangle)
                {
                    while (true)
                    {
                        (Shape as IAutoShape).AppendTextFrame(text);
                        (Shape as IAutoShape).TextFrame.AutofitType = TextAutofitType.Shape;
                        if (Shape.Top + Shape.Height > Pres.SlideSize.Size.Height)
                        {
                            Console.WriteLine("Text Overflowed from Slide");
                        }
                    }
                }

            }

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.Presentation