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).
@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:
@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.
We are still facing issues when we are trying to use “Resize shape to fit text” option for a text box via aspose library.
Attached is a powerpoint file “resize_bug.pptx” which contains one text box (where the text is overflowing from the text box)
I opened this presentation via aspose and used the commands below:
and saved the presentation after that. The text box still did not resize properly to fit the text.
The output presentation is attached by the name “output.pptx”.
Please help us with the same.
NOTE: When I use the same option from the powerpoint application, then the text box is resized properly and fits in all the text. But the same is not happening via aspose. Attachments.zip (44.2 KB)
@Prezent_Inc,
Unfortunately, I was unable to reproduce the problem you described with Aspose.Slides for Python 24.6 and 25.2. I used the following code example:
with slides.Presentation("resize_bug.pptx") as presentation:
shape = presentation.slides[0].shapes[0]
shape.text_frame.text_frame_format.autofit_type = slides.TextAutofitType.NONE
shape.text_frame.text_frame_format.autofit_type = slides.TextAutofitType.SHAPE
presentation.save("output.pptx", slides.export.SaveFormat.PPTX)
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.