Hi Tamas,
Currently there is no direct way for duplicating slides using the MATLAB report generator. But there are a couple of workarounds available for doing so, as provided below. Let me go in order starting with creating a new presentation, then moving to the approaches for duplicating slides.
ppt = Presentation('myPresentation.pptx');
titleSlide = add(ppt,'Title Slide');
replace(titleSlide,'Title','Create Presentation');
subtitleText = Paragraph('The ');
funcName = Text('SubText for ppt');
funcName.Font = 'Courier New';
append(subtitleText,funcName);
append(subtitleText,' Function');
replace(titleSlide,'Subtitle',subtitleText);
textSlide1 = add(ppt,'Title and Content');
titleText = Paragraph('What You Can Do with ');
func = Text('presentations');
func.Font = 'Courier New';
replace(textSlide1,'Title',titleText);
replace(textSlide1,'Content',{'Create presentations',...
'Specify:',{'Workflow','Explanations'},...
textSlide2 = add(ppt,'Title and Content');
- Approach-1: Duplicating contents of "textSlide1" into "textSlide2".
for iPlaceholder = 1:length(textSlide1.Children)
currPlaceholder = textSlide1.Children(iPlaceholder);
for iChildPara = 1:length(currPlaceholder.Children)
slide1ParaObj = currPlaceholder.Children(iChildPara);
slide2ParaObj = Paragraph(slide1ParaObj.Children(1).Content);
paraObjProp1 = properties(slide1ParaObj);
for iParaProp = 1:(length(paraObjProp1)-4)
slide2ParaObj.(paraObjProp1{iParaProp}) = slide1ParaObj.(paraObjProp1{iParaProp});
for iiChildPara = 1:length(slide1ParaObj.Children)
append(slide2ParaObj,slide1ParaObj.Children(iiChildPara).Content);
paraObjProp2 = properties(slide1ParaObj.Children(iiChildPara));
for iParaProp = 1:(length(paraObjProp2)-4)
slide2ParaObj.Children(iiChildPara).(paraObjProp2{iParaProp})...
= slide1ParaObj.Children(iiChildPara).(paraObjProp2{iParaProp});
textSlide2.Children(iPlaceholder).add(slide2ParaObj);
- Approach-2: An array of objects is created containing identical content and are placed consecutively.
textSlide(i) = add(ppt,'Title and Content');
titleText = Paragraph('What You Can Do with ');
func = Text('presentations');
func.Font = 'Courier New';
replace(textSlide(i),'Title',titleText);
replace(textSlide(i),'Content',{'Create presentations',...
'Specify:',{'Workflow','Explanations'},...
Note: The duplicating of slides using Approach-1 works for text content only, as duplicating slides feature is under development.