[TextFrameFormat.AutoFitType Property] Textbox/Shape Autofit Property Is Not Working Properly

Working with - Aspose.Slides Python library.
When I try to resize shape to fit text using the [TextFrameFormat.AutoFitType Property] on a text box then the height of the output text box is not wrapped properly.

Example:
When I try to use this code snippet on a pptx file, then the output appears as visible in attached in screenshot(shape_fit_via_aspose file)

with slides.Presentation("input.pptx") as presentation:

    presentation.slides[0].shapes[0].text_frame.text_frame_format.wrap_text = slides.NullableBool(True)
    presentation.slides[0].shapes[0].text_frame.text_frame_format.autofit_type = slides.TextAutofitType.SHAPE

    presentation.save("output.pptx", slides.export.SaveFormat.PPTX)

However, when we try to use the powerpoint application to apply the same “Resize shape to fit text” setting on the text box, then the output appears as visible in screenshot(shape_fit_via_powerpoint file).

shape_fit_via_aspose.jpg (113.7 KB)
shape_fit_via_powerpoint.jpg (116.0 KB)

@Prezent_Inc,
Thank you for contacting support. I am working on the issue and will get back to you soon.

@Prezent_Inc,
Please share the following files and information:

  • input and output presentation files (you can zip the files and upload an archive here)
  • Aspose.Slides version you used

Hello Andrey,
Hope following helps -
Aspose.Slides version = 24.6.0
Input pptx and Python script.zip (30.5 KB)

@Prezent_Inc,
Thank you for the presentation file. With Aspose.Slides for Python 24.6, I was unable to reproduce the problem you described. My result: output.zip (27.7 KB). Unfortunately, we need more information on how to reproduce the problem on our end.

Please also note that the wrap_text property should be used like this:

presentation.slides[0].shapes[0].text_frame.text_frame_format.wrap_text =
    slides.NullableBool.TRUE

aspose_issue.zip (56.3 KB)

Hi Andrey

Can you check for these input and output files? We are still facing the same issue as described previously.

Thank you.

@Prezent_Inc,
I tested the problem and got the same results. Please also note that the “input.pptx” file you provided and the file you provided above are identical.