Effacer les filtres
Effacer les filtres

Paste a figure to powerpoint with actxserver when the presentation is invisible

7 vues (au cours des 30 derniers jours)
jr1995
jr1995 le 2 Mai 2023
Hi,
I am using actxserver('PowerPoint.Application') to make PowerPoint presentations in Matlab. I changed the Open function to make the presentation invisible:
h = actxserver('PowerPoint.Application'); %Create an ActiveX object
hInterface = h.Presentation.Open( fullfile(obj.templatePath_1, obj.templateName_1), 0,0,0 ); %Open an existing presentation by supplying the fullpath to the file
To copy figures I use the following method:
function addFigure(obj, actserverPP_in, presentationInterface_in)
%Function to copy the figure of the object to the their figure
%placeholder
if exist( fullfile(obj.figurePath_1, obj.figureName_1), 'file') == 2 %Check if figure exists
openfig( fullfile(obj.figurePath_1, obj.figureName_1), 'invisible');
print -clipboard -dmeta
noLastSlide = presentationInterface_in.Slides.Count; %Get index of last slide
Slide = presentationInterface_in.Slides.Item(noLastSlide); %Last slide
%Slide.Select; %Select last slide -> not allowed when presentation is invisible
Slide.Shapes.Placeholders.Item( obj.itemId_1 ).Select; %Select item to copy to
actserverPP_in.ActiveWindow.View.Paste
close %Close figure
end
end
While the presentation was visible, I was able to select the slide and the placeholder item to copy the figure to. Now selecting the placeholder and paste the figure does not work anymore. I am looking for something like set(Slide.Shapes.Placeholders.Item( obj.itemId_1 ), 'Figure', fig_handle)
Any suggestions? Thanks a lot!

Réponses (0)

Catégories

En savoir plus sur Use COM Objects in MATLAB dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by