Caught "std::exception" Exception message is: createInputStream failed:

7 vues (au cours des 30 derniers jours)
Stephanie Farney
Stephanie Farney le 23 Juin 2020
Commenté : Andreas le 10 Fév 2023
Hi all,
I'm working on a program in MATLAB 2019b to analyze test data and automatically generate a PowerPoint report of the results using mlreportgen.ppt. The code is set up to use a template to create the presentation and replace various uniquely named picture placeholders with the figures it generates. I unfortunately can't post my exact code, but here is a recreation of the relevant portions:
import mlreportgen.ppt.*
template = 'myTemplate.pptx';
newSlides = 'finalReport.pptx';
slides = Presentation(newSlides,template);
%code to generate plot
saveas(gcf, 'Fig1.png');
replace(slides,'Picture Placeholder Name', Picture('Fig1.png'));
close(slides);
The error is occurring at close(slides), and gives the following error message:
Caught "std::exception" Exception message is:
createInputStream failed:
In addition to replacing figures, the code is also set up to replace to replace titles and various textboxes in the PowerPoint. When you run the code without the commands to replace the pictures (leaving commands to replace text), it works fine, and when I give the close(slides) command, it generates a PowerPoint with the replaced text and all of the slides from the template. The error only occurs when I try to replace the picture placeholders with figures. When I inlude those commands, the resulting PowerPoint still has the replaced text, but all of the slides after the first slide I attempt to replace a picture on are deleted. I wasn't able to find any info on the exact error, but a similar error recommended using fclose('all') to solve it. I've tried including that command before close(slides), and it didn't help.
Have any of you encountered this error before? Thank you in advance for your help!
  3 commentaires
Stephanie Farney
Stephanie Farney le 24 Juin 2020
Thank you for your response! Both files are writeable, but double checking that info did end up leading me to the issue. I was saving the plots to a subfolder of the directory, and I didn't specify the subfolder in the replace function. Adding the full file path fixed the issue.
Andreas
Andreas le 10 Fév 2023
Hello Stephanie Farney, could you please elaborate with an example. I am running into almost the exact issue you have and need some further insight.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur MATLAB Report Generator dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by