python-pptx 制作的演示文稿中的字体大小
font size in presentation made by python-pptx
如何更改幻灯片上文本的大小。
我不知道为什么,但默认情况下文本大小是 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
简而言之,如果你想控制文本格式(字体属性),你需要在 运行 级别(比 段落),这是应用文本格式的地方。
如何更改幻灯片上文本的大小。 我不知道为什么,但默认情况下文本大小是 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
简而言之,如果你想控制文本格式(字体属性),你需要在 运行 级别(比 段落),这是应用文本格式的地方。