Filter löschen
Filter löschen

Adding bulleted list to PowerPoint using MATLAB Report Generator

15 Ansichten (letzte 30 Tage)
Jayanth Suresh
Jayanth Suresh am 24 Sep. 2021
Beantwortet: Rahul Singhal am 6 Okt. 2021
I am trying to create a automated PowerPoint generation tool using MATLAB Report Generator.
I am unable to add a Bulleted List (using mlreportgen.ppt.Paragraph class) when I am using a template while creating the presentation. When I use a default ppt without mentioning a template the same set of lines does the work.
I am trying to achieve a format similar to this.
I am able to achieve this if I use,
import mlreportgen.ppt.*
ppt = Presentation('test.pptx'); % create a ppt named 'test'
textSlide = add(ppt,'Title and Content');
para = Paragraph("First Content Slide");
para.FontColor = "blue";
replace(textSlide,"Content",["First item","Second item","Third item"]);
I am unable to do the same if I use a template. The code runs without any errors but a blank presentaion is created without the bulleted items.
ppt = Presentation('test.pptx', 'template.pptx'); % template.pptx can be any Microsoft Office provided template
(The first argument to Presentation() class is the name of ppt we would like to create and the second argument is the template we would like to use)
Any suggestions to overcome this? It would also be good to know if we can apply the layouts after getting the necessary information in there.

Antworten (2)

Sean de Wolski
Sean de Wolski am 24 Sep. 2021
The template should not be a pptx file but a potx file.
  1 Kommentar
Jayanth Suresh
Jayanth Suresh am 28 Sep. 2021
I tried the same with template.potx and the problem still persists. I am not able to include Paragraph in a presentation created with a template

Melden Sie sich an, um zu kommentieren.

Rahul Singhal
Rahul Singhal am 6 Okt. 2021
Hi Jayanth,
The reason for the missing data in the generated presentation, only when using the custom template, can be because of the mismatch in the placeholder names that are used in the MATLAB script than those defined in the custom template file. When the slide's replace() method is used to replace any placeholder with some content, the placeholder name being replaced should match with what is defined in the corresponding slide layout in the template file. So to fix this issue, you can either update the placeholder names in the template file or update them in the script, so that the names are consistent at both the places.
To view or update the names of placeholders in the template file, see
Such problems can be avoided if the default PPT API template is used as the starting point to create custom templates. This link can be helpful on how to create and customize a copy of the default PPT API template:




Community Treasure Hunt

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

Start Hunting!

Translated by