使用 python-pptx 设置主题
Set theme with python-pptx
PowerPoint 有可供选择的主题。选择是这样的:
有没有办法用 python-pptx
设置新演示文稿的主题?
类似于:
from pptx import Presentation
prs = Presentation()
prs.set_theme(theme)
...
在 this github issue 它建议创建一个带有主题的 powerpoint 然后打开它。
In that starting .pptx file you would include your customized themes. You can do this by creating a presentation that uses all the themes you would like to have available and then deleting all the slides (but not the slide masters or slide layouts). You will be left with an empty presentation having multiple slide masters, each of which has its own set of slide layouts.
基本上,您使用该主题创建一个模板并将其用作起点(而不是内置的默认主题)。
- 在 PowerPoint 中打开一个包含所需主题的新演示文稿。
- 将其另存为 .pptx 并使用您想要的名称,也许
madison.pptx
用于屏幕截图顶行中的第三个。
在创建新演示文稿时使用该演示文稿作为您的 "starting point":
prs = Presentation("madison.pptx")
新演示文稿 (prs
) 将应用麦迪逊主题。
python-pptx
还不能将主题应用于现有演示文稿。
PowerPoint 有可供选择的主题。选择是这样的:
有没有办法用 python-pptx
设置新演示文稿的主题?
类似于:
from pptx import Presentation
prs = Presentation()
prs.set_theme(theme)
...
在 this github issue 它建议创建一个带有主题的 powerpoint 然后打开它。
In that starting .pptx file you would include your customized themes. You can do this by creating a presentation that uses all the themes you would like to have available and then deleting all the slides (but not the slide masters or slide layouts). You will be left with an empty presentation having multiple slide masters, each of which has its own set of slide layouts.
基本上,您使用该主题创建一个模板并将其用作起点(而不是内置的默认主题)。
- 在 PowerPoint 中打开一个包含所需主题的新演示文稿。
- 将其另存为 .pptx 并使用您想要的名称,也许
madison.pptx
用于屏幕截图顶行中的第三个。 在创建新演示文稿时使用该演示文稿作为您的 "starting point":
prs = Presentation("madison.pptx")
新演示文稿 (prs
) 将应用麦迪逊主题。
python-pptx
还不能将主题应用于现有演示文稿。