gpt4 book ai didi

python - python-pptx 制作的演示文稿中的字体大小

转载 作者:太空宇宙 更新时间:2023-11-03 13:56:14 25 4
gpt4 key购买 nike

如何更改幻灯片上文本的大小。我不知道为什么,默认情况下文本大小是 32。抱歉我的英语不好。这是我的代码:

    TEXT = ['''Help on method shuffle in module random:

shuffle(x, random=None) method of random.Random instance
Shuffle list x in place, and return None.

Optional argument random is a 0-argument function returning a
random float in [0.0, 1.0); if it is the default None, the
standard random.random will be used.''', '''Help on method choice in
module random:

choice(seq) method of random.Random instance
Choose a random element from a non-empty sequence.''', '''Help on
method randint in module random:

randint(a, b) method of random.Random instance
Return random integer in range [a, b], including both end
points.''']
NAMES = ['shuffle', 'choice', 'randint']


from pptx import Presentation
prs = Presentation()
slide_layout = prs.slide_layouts[1]
for i in range(3):
slide = prs.slides.add_slide(slide_layout)
title = slide.placeholders[0]
content = slide.placeholders[1]
title.text = NAMES[i]
content.text = TEXT[i]
prs.save('test.pptx')

最佳答案

此主题包含在此处的文档中:
http://python-pptx.readthedocs.io/en/latest/user/text.html

简单来说,如果您想控制文本格式(字体属性),您需要在 run 级别(比 paragraph 低一级)工作,即应用文本格式的位置。

关于python - python-pptx 制作的演示文稿中的字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49585165/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com