Merge powerpoint presentations on Apple Silicon
1 次查看(过去 30 天)
显示 更早的评论
Is there a way to merge multiple powerpoint (pptx) files into a single .pptx from within the matlab report generator or any other know submission on Apple Silicon? IE - without com objects or activeX? Bonus points if I can then export as a PDF, but this seems like a long shot.
exportToPPTX seems promising, but as of yet I cannot get it to work.
2 个评论
回答(1 个)
Divyanshu
2024-1-31
编辑:Divyanshu
2024-1-31
Hi Oran,
Without using actxserver a lot of manual-coding is required to merge the presentations specifically using 'mlreportgen'. You can refer the following sample code which can be a possible workaround:
Please refer the following pointers to understand the code:
- This piece of code initially creates two presentations 'file1.pptx' & 'file2.pptx'.
- After that a new slide is added to 'file1' and then we are going to replace the title and contents of this new slide.
- The slide contents are replaced with the current slide of 'file2.pptx'
import mlreportgen.ppt.*
ppt = Presentation('file1.pptx');
open(ppt);
titleSlide = add(ppt,'Title Slide');
replace(titleSlide,'Title','Presentation Title 1');
contentSlide1 = add(ppt,'Title and Content');
replace(contentSlide1,'Title','This is the Title of the Content Slide for Presentation 1');
blankSlide = add(ppt,'Blank');
ppt2 = Presentation('file2.pptx');
open(ppt2);
titleSlide = add(ppt2,'Title Slide');
replace(titleSlide,'Title','Presentation Title 2');
contentSlide2 = add(ppt2,'Title and Content');
replace(contentSlide2,'Title','This is the Title of the Content Slide for Presentation 2');
replace(contentSlide2,'Content','A dummy content for presentation 2');
close(ppt2);
open(ppt);
contentSlide = add(ppt,'Title and Content');
newTitle = contentSlide2.Children(1).Children(1).Children(1).Content; %reading the title from slide of presentation2
newContent = contentSlide2.Children(2).Children(1).Children(1).Content; %reading the content from slide of presentation2
replace(contentSlide,'Title',newTitle);
replace(contentSlide,'Content',newContent);
close(ppt);
rptview(ppt);
Note: I have created only two slides for input presenations and the object which refers the slide of ppt2 is static here and may be required to make it dynamic by attaching to some loop based on use-case.
Hope it helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Report Generator 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!