如何让Powerpoint自动调整文本

是否有可能让Powerpoint 2013正确地自动调整文本?我正在使用
python-pptx,我可以设置自动调整选项,但最初不起作用.如果我调整文本框的大小或随后更改像“换行”这样的设置,则自动调整工作.但是,我不能从python-pptx那样做.我第一次添加文本时需要选项才能工作.

我认为这是PowerPoint中的一个错误,微软不打算修复,但希望我错了.

最佳答案 这是一个简单的代码,它将文本包装在文本框架中,而无需调整文本框的大小.我希望这有帮助.

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

更多细节可以在http://python-pptx.readthedocs.io/en/latest/api/text.html#textframe-objects找到

点赞