使用 Matlab Activex 控件裁剪 MS Word 图像 [英] Crop MS Word Images using Matlab Activex control
本文介绍了使用 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 文件交换 "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屋!
查看全文