How to get Powerpoint for auto-matching text

Is it possible to get Powerpoint 2013 to correctly autofocus text? I am using python-pptx and I can set the autofit parameter, but it does not work initially. If I resized the text box or subsequently changed the wrapper setting, then auto-selection works. However, I cannot do this from python-pptx. I need an option to work the first time I add text.

I assume this is a PowerPoint error that Microsoft does not intend to fix, but I hope I'm wrong.

+4
source share
1 answer

Here is a simple code that will wrap text in a text frame without having to resize the text box. Hope this helps.

from pptx import Presentation from pptx.util import Inches prs = Presentation() titleLayout = prs.slide_layouts[0] slide = prs.slides.add_slide(titleLayout) textBox = slide.shapes.add_textbox(Inches(3.5), Inches(0.5),Inches(3), Inches(3.0)) textFrame = textBox.text_frame textFrame.word_wrap = True textParagraph = textFrame.add_paragraph() textParagraph.text = "This is a word_wrap example. The words are wrapped within the textframe" prs.save("C:\OSGeo4W\GPSPictureManager\Tests\PptxWordWrapTest.pptx")#specify path for new pptx file 

More information can be found at http://python-pptx.readthedocs.io/en/latest/api/text.html#textframe-objects

+2
source