电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

利用MATLAB生成WORD和EXCEL文档

利用MATLAB生成WORD和EXCEL文档_第1页
1/11
利用MATLAB生成WORD和EXCEL文档_第2页
2/11
利用MATLAB生成WORD和EXCEL文档_第3页
3/11
function ceshi_Word %利用MATLAB 生成Word 文档 % ceshi_Word % % Copyright 2009 - 2010 xiezhh. % $Revision: 1.0.0.0 $ $Date: 2009/12/14 12:37:00 $ % 设定测试Word 文件名和路径 filespec_user = [pwd '\测试.doc']; % 判断Word 是否已经打开,若已打开,就在打开的Word 中进行操作,否则就打开Word try % 若 Word 服务器已经打开,返回其句柄Word Word = actxGetRunningServer('Word.Application'); catch % 创建一个Microsoft Word 服务器,返回句柄Word Word = actxserver('Word.Application'); end; Word.Visible = 1; % 或 set(Word, 'Visible', 1); % 若测试文件存在,打开该测试文件,否则,新建一个文件,并保存,文件名为测试.doc if exist(filespec_user,'file'); Document = Word.Documents.Open(filespec_user); % Document = invoke(Word.Documents,'Open',filespec_user); else Document = Word.Documents.Add; % Document = invoke(Word.Documents, 'Add'); Document.SaveAs(filespec_user); end Content = Document.Content; Selection = Word.Selection; Paragraphformat = Selection.ParagraphFormat; Document.PageSetup.TopMargin = 60; Document.PageSetup.BottomMargin = 45; Document.PageSetup.LeftMargin = 45; Document.PageSetup.RightMargin = 45; Content.Start = 0; title = '试 卷 分 析 '; Content.Text = title; Content.Font.Size = 16 ; Content.Font.Bold = 4 ; Content.Paragraphs.Alignment = 'wdAlignParagraphCenter'; Selection.Start = Content.end; Selection.TypeParagraph; xueqi = '( 2009 — 2010 学年 第一学期)'; Selection.Text = xueqi; Selection.Font.Size = 12; Selection.Font.Bold = 0; Selection.MoveDown; paragraphformat.Alignment = 'wdAlignParagraphCenter'; Selection.TypeParagraph; Selection.TypeParagraph; Selection.Font.Size = 10.5; Tables = Document.Tables.Add(Selection.Range,12,9); DTI = Document.Tables.Item(1); % 或 DTI = Tables; DTI.Borders.OutsideLineStyle = 'wdLineStyleSingle'; DTI.Borders.OutsideLineWidth = 'wdLineWidth150pt'; DTI.Borders.InsideLin...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

利用MATLAB生成WORD和EXCEL文档

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部