I have been using python-pptx and if scanny sees this: Thank a lot for your work! It has been an absolute pleasure to work with this package. Every functionality I needed was some how available and if I couldn't find it, there was some answer on SO.
Can I count the number of lines my textbox uses after I have inserted my text? According to my reserach you can only count the paragraphs. Of course with some python wizardry I can calculate the amount words and characters but I guess I look for some functionality which in python-pptx
might look like this len(text_frame.lines)
.
If that functionality is available it would be the icing of the cake! If somebody can do this functionality without using python-pttx or even python I am also interested.
Code snippet looks like this:
for slide in prs.slides:
for shape in slide.shapes:
text_frame = shape.text_frame
key=[substring for substring in keys_dict if substring in text_frame.text]
if 'My_Key' in key:
text_frame.text=item_to_replace
print(len(text_frame.paragraphs))
# searched: len(text_frame.lines)