add new slide to a specific index to powerpoint with mlreportgen.ppt in matlab

The following code demonstrates how to add a slide to a specific index of a PowerPoint presentation using mlreportgen.ppt in Matlab:

main.m
import mlreportgen.ppt.*

% Open the PowerPoint presentation
ppt = Presentation('example.pptx');

% Add a new slide at index 3
slide = add(ppt, 'Title and Content', 3);

% Set the title and content of the slide
slide.Title = 'New Slide';
slide.Content = 'This is a new slide added to index 3.';

% Save and close the presentation
close(ppt);
342 chars
15 lines

In this code, we first import the mlreportgen.ppt package. Then, we open an existing PowerPoint presentation called 'example.pptx'. We use the 'add' method to add a new slide of type 'Title and Content' to index 3 of the presentation. We then set the title and content of the slide. Finally, we close the presentation.

related categories

gistlibby LogSnag