Adding bulleted list to PowerPoint using MATLAB Report Generator

조회 수: 11 (최근 30일)
Jayanth Suresh
Jayanth Suresh 2021년 9월 24일
답변: Rahul Singhal 2021년 10월 6일
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'
open(ppt);
textSlide = add(ppt,'Title and Content');
para = Paragraph("First Content Slide");
para.FontColor = "blue";
replace(textSlide,"Title",para);
replace(textSlide,"Content",["First item","Second item","Third item"]);
close(ppt);
rptview(ppt);
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.

답변 (2개)

Sean de Wolski
Sean de Wolski 2021년 9월 24일
The template should not be a pptx file but a potx file.
  댓글 수: 1
Jayanth Suresh
Jayanth Suresh 2021년 9월 28일
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

댓글을 달려면 로그인하십시오.


Rahul Singhal
Rahul Singhal 2021년 10월 6일
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 https://www.mathworks.com/help/rptgen/ug/access-powerpoint-template-elements.html#buzo51h
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: https://www.mathworks.com/help/rptgen/ug/set-up-the-powerpoint-template.html#buzlrt3-1
-Rahul

카테고리

Help CenterFile Exchange에서 Update PowerPoint Presentation Content에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by