Editing Master Slides via PPT API

10 次查看(过去 30 天)
Mark T
Mark T 2020-9-17
回答: Shuai Zheng 2020-10-16
Hi there,
I am using a template pptx to generate a new ppt using the following lines
import mlreportgen.ppt.*; %Import libraries to allow operations on powerpoint presentations
slides = Presentation(GeneralSettings.NameofFinalFile,GeneralSettings.NameofTemplateFile); %Create the new file using the Original as the template
replace(slides,'Date1',GeneralSettings.SummaryDate);
replace(slides,'Date2',GeneralSettings.SummaryDate);
close(slides);
This works if the "Date1" and "Date2" objects are in the normal slide view. But I have some text I want to replace (actually text representing the date) which is in the MASTER SLIDE of the presentation. I don't appear to have access to the Object to perform the replace command. Does anyone know how to get a handle to an object in a Presentation's master slide?
The Mathworks documentation is very thorough in instructing how to create master slides, but not how to then change content in them programmatically (unless I've missed something).

回答(1 个)

Shuai Zheng
Shuai Zheng 2020-10-16
Hello Mark:
Thank you for posting this question. Please notice that slide master's placeholders of date type, slide number, and footer cannot be updated programmatically. If you want to update such information programmatically, please remove these placeholders from the slide master and add the corresponding text placeholders in the layouts. These text placeholders in the layout can then be replaced programmatically by using the "replace" function.
For the example of using “replace” function, please refer to the link below:
I hope this helps.
Thank you again!

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by