Free Support Forum -

Aspose.Slides.TextFrame.FitTextToShape() doesn't work

I’m having a breaking bug in the Aspose.Slides.TextFrame.FitTextToShape() -function. I’m trying to make a simple rectangle to the PowerPoint slide, put some text in it and then make the text to fit inside the rectangle.

I’ using the version of the Aspose.Slides for .NET 4.0 component.

the code is as simple as:
Dim objSlide As AsposeSlides.Slide = pres.Slides(pres.Slides.Count - 1)
Dim tshape As AsposeSlides.Rectangle = objSlide.Shapes.AddRectangle(1694, 1017, 1374, 104)
With tshape.TextFrame
.Text = “Long long long longlong long long text”
End With
The error message is:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

I’ve got the “fit text to place holder” -functionality working sometime before, but I was back then using another version of the dll.

Could you please help me to get the functionality working.

Hi Antti,

I have worked over the scenario shared by you and have been able to reproduce the issue specified. An issue with ID SLIDESNET-33836 has been created in our issue tracking system to furher investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

One more thing that I have observed that with increased size of rectangle there is no exception but generated presentation is still not having effect of applied property. I also like to add further that FitTextToShape() method can decrease the size of text upto 80% only. I will share the further information with you as soon as it will be shared by our development team.

Aspose.Slides.Rectangle tshape = objSlide.Shapes.AddRectangle(1694, 1017, 2074, 254);

We are sorry for your inconvenience,