forked from tuwien-musicir/rp_extract
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_presentation.py
50 lines (39 loc) · 1010 Bytes
/
test_presentation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# import Presentation class
# from pptx library
import collections
import collections.abc
c = collections
c.abc = collections.abc
from pptx import Presentation
...
# Creating presentation object
root = Presentation()
# Creating slide layout
first_slide_layout = root.slide_layouts[0]
""" Ref for slide types:
0 -> title and subtitle
1 -> title and content
2 -> section header
3 -> two content
4 -> Comparison
5 -> Title only
6 -> Blank
7 -> Content with caption
8 -> Pic with caption
"""
# Creating slide object to add
# in ppt i.e. Attaching slides
# with Presentation i.e. ppt
slide = root.slides.add_slide(first_slide_layout)
# Adding title and subtitle in
# slide i.e. first page of slide
slide.shapes.title.text = " Created By python-pptx"
# We have different formats of
# subtitles in ppts, for simple
# subtitle this method should
# implemented, you can change
# 0 to 1 for different design
slide.placeholders[1].text = " This is 2nd way"
# Saving file
root.save("Output.pptx")
print("done")