Presentation
The tppt.Presentation class is a wrapper for the pttx.Presentation class and can be easily wrapped.
However, the primary way to use tppt is through the builder. By using the builder, you can create slides while utilizing slide masters and slide layouts in a type-safe manner.
import tppt
(
tppt.Presentation.builder()
.slide(
lambda slide: slide.BlankLayout()
.builder()
.text(
"Hello, World!",
left=(1, "in"),
top=(1, "in"),
width=(5, "in"),
height=(2, "in"),
)
)
.build()
.save("simple.pptx")
)
Also, tppt.Presentation has a property called tree,
which is a dictionary representing the tree structure of the presentation.
import json
import tppt
print(json.dumps(tppt.Presentation("your.pptx").tree, indent=2, ensure_ascii=False))
It is used for automatic generation of slide master type definitions and can also be used to analyze how pptx files are structured.