scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.37k stars 513 forks source link

find a bug when using text_frame.fit_text(), not deal the situation when returned None #773

Open Amethyst0710 opened 2 years ago

Amethyst0710 commented 2 years ago

when using text_frame.fit_text('Arial', max_size=18) it crushed, the log for this part is as follows.

image

And I enter in the line here text, remainder = self._break_line(line_source, point_size), find the problem is in find_max(), image image

It thinks this will return a object has this two attribute text, remainder , but when it returned None, this line will crush.

scanny commented 2 years ago

What is the size of the textbox and what text are you trying to fit into it? Also, in future, please post traceback as text and code as links to locations in this repo to ease navigating to it.