使用Matlab Activex控件裁剪MS Word图像 [英] Crop MS Word Images using Matlab Activex control

查看:150
本文介绍了使用Matlab Activex控件裁剪MS Word图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MATLAB将字幕图粘贴并粘贴到Microsoft Word中.我也想使用ActiveX控件来裁剪这些图像.

I am using MATLAB to paste and caption plots into Microsoft Word. I would like to also crop these images using the ActiveX control.

类似:

word = actxserver('Word.Application')

word.Visible = 1
op = invoke(word.Documents,'Add')

invoke(word.Selection,'Paste')

invoke(word.Selection,'CropBottom',CropAmount) <----- Except there is no function that will allow me to crop.

我正在修改MATLAB File Exchange "save2word.m"

I am modifying the MATLAB File Exchange "save2word.m"

谢谢

推荐答案

请考虑以下示例:

%# create plot and copy to clipboard
plot(rand(10,1))
print -dmeta

%# open MS-Word
Word = actxserver('Word.Application');
Word.Visible = true;

%# create new document
doc = Word.Documents.Add;

%# paste figure from clipboard
Word.Selection.Paste

%# crop the image
doc.InlineShapes.Item(1).PictureFormat.CropBottom = 100;

%# save document, then close
doc.SaveAs2( fullfile(pwd,'file.docx') )
doc.Close(false)

%# quit and cleanup
Word.Quit
Word.delete

这篇关于使用Matlab Activex控件裁剪MS Word图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆