Formatting issues while printing a colormap on Word or Ppt

1 vue (au cours des 30 derniers jours)
GK15
GK15 le 2 Nov 2018
Réponse apportée : GK15 le 2 Nov 2018
Hello All,
I have matlab code which processes raw data and generates a report with plots in Word or Excel. The plots are in form of colormaps. When the code is running the resolution of the colormap looks fine in .fig format. But when it prints the plot on word/ppt the format changes. See the picture below ( white dotted vertical lines). Has anyone experienced this issue ? and what is the solution?
  1 commentaire
Caglar
Caglar le 2 Nov 2018
Can you post your code? At least the part where it prints.

Connectez-vous pour commenter.

Réponses (1)

GK15
GK15 le 2 Nov 2018
%%------- Export waterfall plot to MS Word -------
if strcmpi(export_type, 'Microsoft Word')
print(hfig, '-dmeta');
invoke(actxWord.Selection, 'Paste');
actxWord.Selection.TypeParagraph; %New line
actxWord.Selection.TypeText(['Figure ' num2str(fig_num) '.']);
fig_num = fig_num + 1;
actxWord.Selection.TypeParagraph; actxWord.Selection.TypeParagraph; %2 new lines
elseif strcmpi(export_type, 'Microsoft PowerPoint')
print(hfig, '-dmeta');
slide_count = get(pptHandle.Slides, 'Count'); %Get current number of slides
slide_count = int32(double(slide_count)+1); %Add a new slide (with title object)
new_slide = invoke(pptHandle.Slides,'Add',slide_count,11);
picShapeRange = invoke(new_slide.Shapes,'Paste');
%pic1 = invoke(new_slide.Shapes,'Paste'); %This line doesn't work with Office 2013
pic1 = invoke(picShapeRange,'Item',1); %Paste the contents of the Clipboard
pic_H = get(pic1,'Height'); %Get height of picture
pic_W = get(pic1,'Width'); %Get width of picture
slide_H = pptHandle.PageSetup.SlideHeight; %Get height of slide
slide_W = pptHandle.PageSetup.SlideWidth; %Get width of slide
%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)));
ppt_title = ['Colormap: Figure ' num2str(fig_num)];
set(new_slide.Shapes.Title.TextFrame.TextRange,'Text',ppt_title); %Insert text into the title object
fig_num = fig_num + 1;
end
hold off %Resets axes properties to their defaults before drawing new plots
clf(hfig,'reset') %Clear figure window with handle "hfig"

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