scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.39k stars 518 forks source link

Fit shape to text? #970

Open Rapid1898-code opened 5 months ago

Rapid1898-code commented 5 months ago

Hello - is there any way to fit a shape to a text?

(so i have a simply text-field in a shape with a background color - and when the text is too long it gets cut - so i want to autosize the shape to the given text)

I tried it with

shape.text_frame.fit_text()

but this seems to only shrink the text itself - but i want to have the shape get fitted to the text.

mszbot commented 2 weeks ago

fit_text is experimental and this will not be fixed in python-pptx. See here: https://github.com/scanny/python-pptx/issues/982