Effacer les filtres
Effacer les filtres

Generating Powerpoint presentation with MATLAB: how can I send an image back if it overlaps with the slide title?

3 vues (au cours des 30 derniers jours)
Hi everyone,
I'm working on a script to generate a PowerPoint presentation. In the resulting PowerPoint file, each slide contains just an image (the figure) and a title (the figure name).
The problem with the slides I generate is that the picture overlaps the title.
In PowerPoint I can just right click the figure and select the "send to back" option, but how can I do this operation using the powershell commands?
My code is
%Get all open figures handles
figHandles = flipud(findall(groot,'Type','figure'));
for NumFig = 1:length(figHandles)
%Recall each figure
figure(NumFig)
titletext = figHandles(NumFig).Name;
% Capture current figure/model into clipboard:
print -dmeta
% Get current number of slides:
slide_count = get(op.Slides,'Count');
% Add a new slide (with title object):
slide_count = int32(double(slide_count)+1);
new_slide = invoke(op.Slides,'Add',slide_count,11);
% Insert text into the title object:
set(new_slide.Shapes.Title.TextFrame.TextRange,'Text',titletext);
% Get height and width of slide:
slide_H = op.PageSetup.SlideHeight;
slide_W = op.PageSetup.SlideWidth;
% Paste the contents of the Clipboard:
pic1 = invoke(new_slide.Shapes,'Paste');
% Get height and width of picture:
pic_H = get(pic1,'Height');
pic_W = get(pic1,'Width');
% Center picture on page (below title area):
set(pic1,'Left',single((double(slide_W) - double(pic_W))/2));
set(pic1,'Top',single(double(slide_H) - double(pic_H)));
end

Réponses (0)

Catégories

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

Produits


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by