To add a new slide to an existing PowerPoint presentation in Matlab, you can use the following code snippet:
392 chars14 lines
In the above code, we first create an ActiveX server object to interact with PowerPoint. We then open the PowerPoint presentation file named example.pptx
. To add a new slide, we get the count of existing slides using presentation.Slides.Count
, and then use the Add
method to create a new slide. The second argument to Add
is the slide layout index, which in this example is set to 11
(a blank slide layout).
Note that you may need to adjust the slide layout index depending on the layout you want to use. The available layout indices can be obtained using presentation.Designs.Item(1).SlideMaster.CustomLayouts.Count
. Finally, we save and close the PowerPoint presentation, and exit the ActiveX server object with ppt.Quit
.
gistlibby LogSnag