Add a title slide to a presentation and then replace the slide placeholders for the title and subtitle with your title and subtitle text.
Import the PPT package so that you do not have to use long, fully qualified names for the PPT API classes.
Create a presentation.
Add a title slide.
Use the find
method of the slide object to find the placeholder object that has the name Title
.
titlePlaceholderObj =
TextBoxPlaceholder with properties:
Bold: []
Font: []
ComplexScriptFont: []
FontColor: []
FontSize: []
Italic: []
Strike: []
Subscript: []
Superscript: []
Underline: []
BackgroundColor: []
VAlign: []
Name: 'Title'
X: '1524000emu'
Y: '1122363emu'
Width: '9144000emu'
Height: '2387600emu'
Style: []
Children: []
Parent: [1×1 mlreportgen.ppt.Slide]
Tag: 'ppt.TextBoxPlaceholder:21:61'
Id: '21:61'
The find
method returns an mlreportgen.ppt.TextBoxPlaceholder
object.
Replace the placeholder content with the title text.
Find the placeholder object for the subtitle.
subtitlePlaceholderObj =
TextBoxPlaceholder with properties:
Bold: []
Font: []
ComplexScriptFont: []
FontColor: []
FontSize: []
Italic: []
Strike: []
Subscript: []
Superscript: []
Underline: []
BackgroundColor: []
VAlign: []
Name: 'Subtitle'
X: '1524000emu'
Y: '3602038emu'
Width: '9144000emu'
Height: '1655762emu'
Style: []
Children: []
Parent: [1×1 mlreportgen.ppt.Slide]
Tag: 'ppt.TextBoxPlaceholder:22:62'
Id: '22:62'
The placeholder object for the subtitle is also an mlreportgen.ppt.TextBoxPlaceholder
object.
Replace the placeholder content with the text for the subtitle.
Close and view the presentation.
Here is the title slide in the generated presentation: