fitTextToShape() not working

Hi,

I need to have more number of paragraphs or the line space is higher in a shape. It grows too large for the slide.

To avoid this I used TextFrame.fitTextToShape() and it does not work correctly. I have attached the sample java file and the output ppt file. I have tried with Aspose for java version 2.4.3. It had not worked with any of the previous versions (1.9, 2.1) too.

Please provide us a solution for the above as early as possible.

Thanks,
Mani.
(Zoho Corp)

Hi Manivannan,

Thanks for your interest in Aspose.Slides.

You are working with slide’s placeholder and trying to apply fitTextToShape() method on com.aspose.slides.Placeholder class. You can not use this method with slide’s placeholder.

You can use this method with Shapes which contain text.The fitTextToShape() belongs to com.aspose.slides.TextFrame. Please visit this documentation link for Aspose.Slides for java object.

Please use the following code snippet for you kind reference.

Presentation pres = new Presentation();
Slide slide = pres.getSlides().get(0);

Rectangle rect1 = slide.getShapes().addRectangle(250, 250, 1500, 2000);

rect1.addTextFrame(“”);
TextFrame txtFrame = rect1.getTextFrame();
txtFrame.setText(“This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.This is text.”);

txtFrame.setWrapText(true);
txtFrame.fitTextToShape();
pres.save(“d:\pptx\fitTextToShape.ppt”, SaveFormat.PPT);
Please let us know if you have any more queries.