Formatting issues while printing a colormap on Word or Ppt

조회 수: 1 (최근 30일)
GK15
GK15 2018년 11월 2일
답변: GK15 2018년 11월 2일
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
Caglar
Caglar 2018년 11월 2일
Can you post your code? At least the part where it prints.

댓글을 달려면 로그인하십시오.

답변 (1개)

GK15
GK15 2018년 11월 2일
%%------- 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"

카테고리

Help CenterFile Exchange에서 Update PowerPoint Presentation Content에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by