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
相关问题 更多 >
编程相关推荐