在matlab中建立word
try
%若word服务器已经打开,返回其句柄Word
Word = actxGetRunningServer('Word.Application');
catch
%创建一个Microsoft Word服务器,返回句柄Word
Word = actxserver('Word.Application');
end;
set(Word, 'Visible', 1); %或Word.Visible=1;
documents = Word.Documents;
if exist('wordname','file');
document = invoke(documents,'Open','wordname');
else
document = invoke(documents, 'Add');
end
% 利用content接口写入汉字
Content=document.Content; %返回Document的Content句柄
set(Content, 'Start',0);
%设置文档内容的起始位置
title='试
卷
分
析';
set(Content, 'Text',title); %输入文字内容
Content.Font.Size=16;
%设置字号16
Content.Font.Bold=4;
%字体加粗
Content.Paragraphs.Alignment='wdAlignParagraphCenter';%居中
%将图片发到剪切板用粘贴到word
I_On=dicomread('E:courseDigital_image302_HELIONT1MPR.MR..0007.0100.2014.10.16.13.00.00.593750.206556386.IMA');
H=figure();
imshow(I_On,[]);
print(H,'-dbitmap');%将图片发到剪切板
Selection=Word.Selection;
Selection.Range.Paste;%在当前光标的位置插入图片
最后
以上就是腼腆小蝴蝶最近收集整理的关于[matlab]用matlab建立word,并在word中写入文字和图片的全部内容,更多相关[matlab]用matlab建立word内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复