We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue with shape autofit

Hi,

I found an issue with a shape not keeping its “Shrink text on overflow” autofit property after paragraphs are added to it.
Please see the attached example AutofitTest.pptx file. There is a shape in it with Autofit set to “Shrink text on overflow”.

In the code below, I am adding a few paragraphs to the shape. At the end, the shape still shows the Autofit set to “Shrink text on overflow”, however, the text does not shrink.

FileInputStream fileInput = new FileInputStream( “c:/TestAutofit.pptx”);
Presentation pres = new Presentation( fileInput );

ISlide slide = pres.getSlides().get_Item(0);
IAutoShape shape = (IAutoShape) slide.findShapeByAltText(“autofitTest”);
System.out.println("Shape autofit: " + shape.getTextFrame().getTextFrameFormat().getAutofitType() );

String longString = “This is a long paragraph. This is a long paragraph. This is a long paragraph. This is a long paragraph. This is a long paragraph.”;
Paragraph para;

for( int i = 0; i<4; i++ )
{
para = new Paragraph();
para.setText(longString);
shape.getTextFrame().getParagraphs().add(para);
}

System.out.println("Paragraphs inserted: " + new Date());
FileOutputStream fileOutput = new FileOutputStream( “c:/output.pptx”);
pres.save( fileOutput, SaveFormat.Pptx );

Please let me know if this can be fixed.
Thanks,

Natasa

HI Natasa,

Thank you for sharing the template file and sample code.

I am able to reproduce your mentioned issue after an initial test. Your issue has been registered in our issue tracking system with issue id: SLIDESJAVA-34540. You will be notified via this forum thread once the issue gets resolved.

Thanks & Regards,

The issues you have found earlier (filed as SLIDESJAVA-34540) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi,

I appreciate that you attended this issue so promptly, however, when I tested using Aspose Slides 14.7.0 version and the example as posted above, I am still getting the same output: the text in the shape does not shrink. Please let me know if there is anything I am missing or if this is still an issue.

Thanks,

Natasa

Hi Natasa,

Please update the code as per below and let us know in case you still face the issue.

ISlide slide = pres.getSlides().get_Item(0);
IAutoShape shape = (IAutoShape) slide.findShapeByAltText(“autofitTest”);
shape.getTextFrame().getTextFrameFormat().setAutofitType(TextAutofitType.Normal);
System.out.println("Shape autofit: " + shape.getTextFrame().getTextFrameFormat().getAutofitType() );

Thanks & Regards,

The issues you have found earlier (filed as SLIDESJAVA-34540) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.