Can't open powerpoint file using mlreportge​n.ppt.Pres​entation Class

Everytime I try to open a .pptx file using mlreportgen.ppt.Presentation I get an error.
import mlreportgen.ppt.*
pptObj = Presentation('test.pptx','template.pptx')
pptObj =
Presentation with properties:
TemplatePath: 'template.pptx'
OutputPath: '\\ad\empiredfs\data\aero1\Users\nemecect\Tools\matlab\src\file\exportToPowerPoint\test.pptx'
Children: []
Parent: []
Tag: 'ppt.Presentation:27'
Id: '27'
open(pptObj)
Error using mlreportgen.ppt.Presentation/open
Cannot open file. //ad/empiredfs/data/aero1/Users/nemecect/Tools/matlab/src/file/exportToPowerPoint/test.pptx
I get the error if test.pptx has already been created and I'm trying to add to the file. After the error, test.pptx goes from its original file size to 0 KB, so it effectively deletes/erases the file.
Also, I get the error if test.pptx has not been created and I'm trying to create a new file from the template. After the error, test.pptx is created with a file size of 0 KB.
How can I debug this or make this work? The error is very unhelpful. The file definitely exists. It is not open in Powerpoint and is not locked.

Answers (1)

Hi Chris,
I understand you are facing an error while generating a PowerPoint presentation using MATLAB report generator.
I tried the workflow you mentioned and created a “template.pptx” file. I was not able to reproduce the error. I faced a similar error after removing the “template.pptx” file. Make sure the path to template file is correct.
Also, make sure you have permission to write in your current folder. I was able to reproduce the exact error after removing write permissions for the current directory.
To learn more about MATLAB report generator, please go through this official MATLAB documentation.
Thanks

1 Comment

It does seem to be a permissions issue potentially with test.pptx. The directory is on a linux network share that is accesible on WIndows. I am running the code from Matlab on Windows. I tried chmod 777 test.pptx on linux and re-running the code on Windows, but that didn't resolve the issue either. I tried allowing all permissions on test.pptx on the Windows side through Properties, but that didn't resolve the issue either.
I moved all files to my local C: drive and everything worked as expected.
There must be some unique permission setup for network share.

Sign in to comment.

Categories

Products

Release

R2023b

Asked:

on 24 Sep 2024

Commented:

on 25 Sep 2024

Community Treasure Hunt

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

Start Hunting!