Manage powerpoint on Matlab

57 vues (au cours des 30 derniers jours)
Ortinomax
Ortinomax le 15 Avr 2015
Commenté : Ashwini More le 3 Fév 2020
Hello,
Part of my job is now to create powerpoint with a lot of figure which "that is good ..." "that is not..". And all of the figure came from Matlab. I spent time to copy/paste one by one (and resizing since my Matlab figure are big). I searched how to automate this but I didn't find the keys.
Apparently, it involves the COM Auomation but I don't find documentation on it.
I found those things, which looked helpful but...
I tried to copy-past the saveppt code (my trash.m file), but I get an error (although the file exist) :
??? Invoke Error, Dispatch Exception: Le fichier spécifié est introuvable.
op = invoke(ppt.Presentations,'Open','validation_ppt.pptx',[],[],0);
in english : The specified file is missing.
I don't find any documentation on this. So I'm blocked.
If someone tells me : "Hey, here there is a pdf file on COM Automation server which explain how it works in Matlab." I would be happy.
(I don't really searched an answer on my present issue, since it will only be the first of the list. But how to get find documentation.)
EDIT : I linked the wrong file.
  2 commentaires
Ortinomax
Ortinomax le 16 Avr 2015
Thanks Sebastian Castro
One solution lead to another problem. So i'm stuck again. I tried to have my figure copied in the clipboard and then paste on the powerpoint.
ppt = actxserver('powerpoint.application');
myPres=ppt.Presentations.Open('D:\Perso\myppt.pptx');
slide3=myPres.Slides.Item(3); % slect the slide 3
myFIg=figure(); %create the figure to test
plot([0 1],[1 1],'m');
print('-dmeta',myFIg) % copy to clipboard
% past to the slide 3, and get the handles of the picture (useful to resize, move...)
pic(k)=slide3.Shapes.PasteSpecial().Item(1);
It works, and almost good. But when I do the same manually (Figure>Edit>Copy Figure then Powerpoint>Paste), the picture has transparency. It needs the transparency back.
I thought it could be done with optional argument of the PasteSpecial method. But I need to pass an PpPasteDataType argument, and everything I tried fail (Type Mismatch).
Any help would be appreciated.
Ashwini  More
Ashwini More le 3 Fév 2020
Hi,
I am working on adding images to existing powerpoint with matlab code. Your code helps me but instead of plotting figure in matlab, I have to add only .jpg figure.
So how can I change this code so that it will help me to copy specific image at specified location?
Any help would be appreciated!!

Connectez-vous pour commenter.

Réponse acceptée

Sebastian Castro
Sebastian Castro le 15 Avr 2015
  1 commentaire
Ortinomax
Ortinomax le 16 Avr 2015
I missed it. Thanks

Connectez-vous pour commenter.

Plus de 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