how to increase the slide size a python generated powerpoint presentation using python-pptx

泄露秘密 提交于 2020-07-03 08:13:10

问题


Am trying to fit multiple charts into a python generated slide but I need the size of the slide to be wider. I looked through the available documentation provided which aren't much.


回答1:


I was able to resolve this by adjusting the width and height size of the prs

prs = Presentation()
prs.slide_width = 11887200
prs.slide_height = 6686550



回答2:


The default width and height for a slide generated by pptx is 10 inches width and 7.5 inches height. The following code will work to change its default slide width and height:

from pptx import Presentation
from pptx.util import Inches


prs = Presentation()
# set width and height to 16 and 9 inches.
prs.slide_width = Inches(16)
prs.slide_height = Inches(9)


来源:https://stackoverflow.com/questions/48604491/how-to-increase-the-slide-size-a-python-generated-powerpoint-presentation-using

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!