Change slide layout using mlreportgen

10 visualizaciones (últimos 30 días)
Abdul Rasyid Haron
Abdul Rasyid Haron el 18 de Oct. de 2021
Editada: Kausthub el 11 de Oct. de 2023
Hi,
I have a powerpoint with 3 blank slides and I want to find the first blank slide and change it to other layout, say 'three content" layout. How can I do this using the MATLAB Report Generator?
regards
rasyid

Respuestas (1)

Kausthub
Kausthub el 11 de Oct. de 2023
Editada: Kausthub el 11 de Oct. de 2023
Hi Abdul Rasyid Haron,
I understand that you would like to change the layout of the first blank slide of your presentation to another layout like “Three Content” using the MATLAB Report Generator.
The “Layout” property of slide class is read-only. Hence, the layout of the slide cannot be changed from “Blank” to any other layout. Also, there is no built-in layout available called “Three Content” similar to “Two content”.
Please refer to documentation of “mlreportgen.ppt.Slide” for more detailed information:https://www.mathworks.com/help/rptgen/ug/mlreportgen.ppt.slide-class.html
A possible workaround for changing the layout would be to customize the “Blank” slide itself and create three text boxes as content spaces. To do this, please follow the bellow steps:
  • Get the slides from the PPT object.
% get all the slides
slides = ppt.Children;
  • Iterate through the slides and find the first blank slide.
  • Customize this slide to have one title and three content spaces by appending text boxes.
% iterate through the slides to find the first blank slide
for slide = slides
% Customize the Layout of the blank slide
if(slide.Layout == "Blank")
% Add Title
titleTB = TextBox();
titleTB.X = '0.5in';
titleTB.Y = '0.5in';
titleTB.Width = '12in';
titleTB.Height = '1in';
add(titleTB,'This is the title of my blank slide');
add(slide,titleTB);
% Add Three Contents
for i = 0:2
contentTB1 = TextBox();
X = 0.5 + i*4.2;
contentTB1.X = string(X) + 'in';
contentTB1.Y = '2in';
contentTB1.Width = '3.9in';
contentTB1.Height = '4.5in';
add(contentTB1,'This is Content' + string(1+i) +' space of my blank slide');
add(slide,contentTB1);
end
break;
end
end
Also, I have attached the script - “changeLayout.m” - containing the workaround. You can refer to this for more clarity.
You can refer to the following documentation pages for further customizations:
Hope this helps and solves your query regarding changing the layout of slides using MATLAB Report Generator!

Categorías

Más información sobre MATLAB Report Generator en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by