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!