开发者

Crop MS Word Images using Matlab Activex control

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

something like:

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.

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

Thanks


Consider this example:

%# 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

Crop MS Word Images using Matlab Activex control

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜