Is there a way to embed a .xlsx object in a ppt from matlab script?

9 ビュー (過去 30 日間)
Aimee Kosenski
Aimee Kosenski 2024 年 6 月 3 日
編集済み: Ishaan Mehta 2024 年 7 月 8 日
I am using mlreportgen.ppt to create a simulation results report in Powerpoint. I wrote tabular results to an Excel .xlsx file and later added them into the .ppt using the Table commands. This works fine, except the tabular results are quite large, and I would like to embed the .xlsx as an object. From the Matlab Help, I found a way to import .xlsx object into a Word Document (using mlreportgen.dom, and EmbeddedObject), but I cannot find a way to import it into a PowerPoint Presentation. There is no EmbeddedObject in the mlreportgen.ppt. Can this be done?

回答 (1 件)

Ishaan Mehta
Ishaan Mehta 2024 年 7 月 8 日
編集済み: Ishaan Mehta 2024 年 7 月 8 日
Hi Aimee,
Since you are unable to add the Excel sheet in your presentation using "mlreportgen.ppt", doing the same using ActiveX controls can help as a workaround.
You can open an existing PowerPoint presentation through MATLAB using the "actxserver" function as illustrated below:
% Define the path to your PowerPoint file and Excel file
pptFilePath = 'presentation.pptx';
excelFilePath = 'excelSheet.xlsx';
% Open PowerPoint application
pptApp = actxserver('PowerPoint.Application');
pptApp.Visible = true;
% Open the PowerPoint presentation
presentation = pptApp.Presentations.Open(fullfile(pwd, pptFilePath));
Then, you can using PowerPoint's ActiveX commands to access the target slide and using the "slide.Shapes.AddOLEObject" method to embed the Excel sheet as an OLE object in the slide.
You can refer to the below documentation for more information:
Hope this helps!

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by