Autofit Property is not working

Hi,

I have been evaluating Aspose slides for Java.
I came across a situation where the text is not fitting to the box by decreasing the size of its font after applying autofit property.
to have a better understanding here is my code.
IPresentation presentation = PresentationFactory.getInstance().readPresentation(Utils.getCustomerTemplate(template.getFileName()));
IMasterSlide masterSlide = presentation.getMasters().get_Item(0);
ILayoutSlide titleLayout = presentation.getLayoutSlides().add(masterSlide, SlideLayoutType.Title, Utils.layoutPrefix + “Title”);
ISlide titleSlide = presentation.getSlides().addEmptySlide(titleLayout);
AutoShape shape = (AutoShape) titleSlide.getShapes().get_Item(0);
shape.getTextFrame().getTextFrameFormat().setAutofitType(TextAutofitType.Normal);

shape.getTextFrame().setText(“Magna auctor semper phasellus arcu nisl tortor aliquam nostra dictum penatibus quis class vel tortor hymenaeos nec posuere nec per euismod cras aptent aptent urna nullam porttitor fringilla lacus ad nam facilisi dictum elementum justo commodo dolor est habitasse magnis fringilla purus aptent aenean condimentum.\n+
\n+
“Consequat curabitur dis eget ultricies in. Semper semper quam diam hymenaeos ultrices phasellus Vulputate laoreet orci sociis integer. Mollis. Magna sapien. Consequat tellus ultrices semper bibendum purus.\n+
\n+
“Per porttitor enim commodo torquent pulvinar. Dolor felis penatibus laoreet augue dui cras praesent sociosqu magna tortor sodales id. Pellentesque curae; dolor sodales imperdiet Lacinia vitae, nostra varius.”);
Utils.printShapeInfo(titleSlide);

AutoShape shape1 = (AutoShape) titleSlide.getShapes().get_Item(1);

shape1.getTextFrame().getTextFrameFormat().setAutofitType(TextAutofitType.Normal);
shape1.getTextFrame().setText(“Hendrerit lacus euismod donec. Quis ultricies diam a nisi eros sociis rutrum. Sociis habitant hendrerit ligula feugiat vivamus, cubilia, duis cras feugiat vulputate class. Velit posuere lobortis varius sodales pharetra.”);
Please have a look at it and advise.
Thanks in advance!
Ashok

Hi Ahsok.

I have observed your requirements and sample code. I have modified your example to an extent in order to use that on my end. I have used the following sample code on my end. For your kind reference, I have attached the source and generated presentation files as well. If you observe slide 1 of Saved.pptx, the Font height for Title placeholder is 44. When we add a new slide (slide 2 using Aspose.Slides) using same layout slide and then populate text height for populated Title placeholder is 40. Which means it has been adjusted to an extent. Even if you add a new slide using PowerPoint and copy the same text inside Title placeholder, it bears the same results as achieved by Aspose.Slides. The 3rd slide in Saved.pptx is infact added using PowerPoint to show the comparison and to elaborate that both Aspose.Slides and PowerPoint behaves the same for your text.

If you are able to achieve different text auto-fit results when directly adding text using PowerPoint then please share the source presentation with us and we will investigate that further on our end to help you out.

Many Thanks,

Hi,

Thanks for replying quickly.We have gone through your proposed solution and found out that it is behaving intermittently.The auto-fit property is not getting applied properly.Some of data is still spilling out.As you suggested it is getting adjusted to an Extent;Can you please suggest what exactly that extent is?
What are the circumstances that would allow auto-fit to work properly.?
What should be the font size?
What should be the Size of the Text?
If you can enlighten more about the extent it would be really helpful for further Evaluation.

Thanks
Ashok

Hi Ashok,

I have observed your comments and have discussed with our product team. An issue with ID SLIDESJAVA-36400 has been created in our issue tracking system to further investigate the issue pertaining to autofit property application in used sample code. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed. I will really appreciate your patience till the time our product team schedule and investigate the issue.

Many Thanks,