Paste a figure to powerpoint with actxserver when the presentation is invisible
조회 수: 7 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Use COM Objects in MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!