add new slide to powerpoint with the mlreportgen.ppt. class in matlab

To add a new slide to an existing PowerPoint presentation using the mlreportgen.ppt class in MATLAB, you can follow these steps:

  1. Open the PowerPoint presentation using open() method.

  2. Create a new slide using add() method.

  3. Add content to the slide using various other methods available within the mlreportgen.ppt class.

  4. Close the presentation using close() method.

Here is an example code snippet to achieve this:

main.m
import mlreportgen.ppt.*

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

% Add new slide to the presentation
slide = add(ppt, 'Title and Content');

% Add title to the slide
title = add(slide, 'Title', 'New Slide');
title.HorizontalAlignment = 'center';

% Add content to the slide
text = add(slide, 'Text', 'This is a new slide added using MATLAB.');
text.Color = 'blue';
text.FontSize = '20pt';

% Close the presentation
close(ppt);
457 chars
20 lines

This code will create a new slide with a title and content in the my_presentation.pptx PowerPoint presentation. You can modify the code as per your requirements to add different types of content to the slide.

related categories

gistlibby LogSnag