[转载]Matlab 生成 Word 报告

时间:2019-09-03
本文章向大家介绍[转载]Matlab 生成 Word 报告,主要包括[转载]Matlab 生成 Word 报告使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

69分 人占 %';
DTI.Cell(7,1).Range.Text = ['试卷分析(含是否符合教学大纲、难度、知识覆'...
'盖面、班级分数分布分析、学生答题存在的共性问题与知识掌握情况、教学中'...
'存在的问题及改进措施等内容)'];
DTI.Cell(7,1).Range.ParagraphFormat.Alignment = 'wdAlignParagraphLeft';
DTI.Cell(9,2).Range.Text = '签字 :';
DTI.Cell(9,4).Range.Text = '年 月 日';
DTI.Cell(10,1).Range.Text = '教研室审阅意见:';
DTI.Cell(10,1).Range.ParagraphFormat.Alignment = 'wdAlignParagraphLeft';
DTI.Cell(10,1).VerticalAlignment = 'wdCellAlignVerticalTop';
DTI.Cell(11,2).Range.Text = '教研室主任(签字): 年 月 日';
DTI.Cell(11,2).Range.ParagraphFormat.Alignment = 'wdAlignParagraphLeft';
DTI.Cell(8,1).Range.ParagraphFormat.Alignment = 'wdAlignParagraphLeft';
DTI.Cell(8,1).VerticalAlignment = 'wdCellAlignVerticalTop';
DTI.Cell(9,2).Borders.Item(2).LineStyle = 'wdLineStyleNone';
DTI.Cell(9,2).Borders.Item(4).LineStyle = 'wdLineStyleNone';
DTI.Cell(9,3).Borders.Item(4).LineStyle = 'wdLineStyleNone';
DTI.Cell(11,1).Borders.Item(4).LineStyle = 'wdLineStyleNone';

% 暂时没搞懂意思,貌似不用也不影响
Shape = Document.Shapes;
ShapeCount = Shape.Count;
if ShapeCount ~= 0;
for i = 1:ShapeCount;
Shape.Item(1).Delete;
end
end

% 绘图并放置于表格单元(8,1)
zft = figure('units','normalized','position',...
[0.280469 0.553385 0.428906 0.251302],'visible','off'); % 定义句柄
% 绘图
set(gca,'position',[0.1 0.2 0.85 0.75]);
data = normrnd(0,1,1000,1);
hist(data);
grid on;
xlabel('考试成绩');
ylabel('人数');

hgexport(zft, '-clipboard'); % 将图片复制到剪切板
DTI.Cell(8,1).Range.Paragraphs.Item(1).Range.PasteSpecial; % 粘贴操作
Shape.Item(1).WrapFormat.Type = 3;
Shape.Item(1).ZOrder('msoBringInFrontOfText');
delete(zft); % 删除句柄

Document.ActiveWindow.ActivePane.View.Type = 'wdPrintView';
Document.Save; % 保存文档
Word.Quit; % 关闭文档

```

原文地址:https://www.cnblogs.com/airbird/p/11455243.html