Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
初级会员
注册日期: 2009-03-02
年龄: 38
帖子: 9
声望力: 0 ![]() |
![]()
我在做毕业设计,是一个数字图象处理软件,我负责总界面.
我现在需要在程序运行完之后,建立一个WORD文件,将运行软件后的参数放入WORD中做成一个实验报告,我在网上只找到一个相关的内容.谁能告诉我,这些语句什么意思.可以在什么书上找到,或者相关知识也请告诉我. 摘录自http://www.chinavib.com/forum/thread-72380-1-1.html filespec = 'C:\Documents and Settings\Administrator\桌面\xiezh.doc'; try; Word=actxGetRunningServer('Word.Application'); catch; Word = actxserver('Word.Application'); end; set(Word, 'Visible', 1); documents = Word.Documents; if exist(filespec,'file') document = invoke(documents,'Open',filespec); else document = invoke(documents, 'Add'); document.SaveAs(filespec); end content = document.Content; duplicate = content.Duplicate; inlineshapes = content.InlineShapes; selection = Word.Selection; paragraphformat = selection.ParagraphFormat; %页面设置 document.PageSetup.TopMargin = 60; document.PageSetup.BottomMargin = 45; document.PageSetup.LeftMargin = 45; document.PageSetup.RightMargin = 45; set(content, 'Start',0); title='试 卷 分 析'; set(content, 'Text',title); set(paragraphformat, 'Alignment','wdAlignParagraphCenter'); rr=document.Range(0,10); rr.Font.Size=16; rr.Font.Bold=4; end_of_doc = get(content,'end'); set(selection,'Start',end_of_doc); selection.TypeParagraph; set(selection, 'Text','(20 —20 学年 第 学期)'); selection.Font.Size=12; selection.MoveDown; set(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.Borders.OutsideLineStyle='wdLineStyleSingle'; DTI.Borders.OutsideLineWidth='wdLineWidth150pt'; DTI.Borders.InsideLineStyle='wdLineStyleSingle'; DTI.Borders.InsideLineWidth='wdLineWidth150pt'; DTI.Rows.Alignment='wdAlignRowCenter'; DTI.Rows.Item(8).Borders.Item(1).LineStyle='wdLineStyleNone'; DTI.Rows.Item(8).Borders.Item(3).LineStyle='wdLineStyleNone'; DTI.Rows.Item(11).Borders.Item(1).LineStyle='wdLineStyleNone'; DTI.Rows.Item(11).Borders.Item(3).LineStyle='wdLineStyleNone'; column_width=[53.7736,80.9434,53.7736,29.0094,29.0094,76.6981,55.1887,52.9245,54.9057]; row_height=[28.5849,28.5849,28.5849,28.5849,25.4717,25.4717,32.8302,312.1698,17.8302,49.2453,14.1509,18.6792]; for i=1:9 DTI.Columns.Item(i).Width =column_width(i); end for i=1:12 DTI.Rows.Item(i).Height =row_height(i); end for i=1:12 for j=1:9 DTI.Cell(i,j).VerticalAlignment='wdCellAlignVerticalCenter'; end end DTI.Cell(1, 4).Merge(DTI.Cell(1, 5)); DTI.Cell(2, 4).Merge(DTI.Cell(2, 5)); DTI.Cell(3, 4).Merge(DTI.Cell(3, 5)); DTI.Cell(4, 4).Merge(DTI.Cell(4, 5)); DTI.Cell(5, 2).Merge(DTI.Cell(5, 5)); DTI.Cell(5, 3).Merge(DTI.Cell(5, 6)); DTI.Cell(6, 2).Merge(DTI.Cell(6, 5)); DTI.Cell(6, 3).Merge(DTI.Cell(6, 6)); DTI.Cell(5, 1).Merge(DTI.Cell(6, 1)); DTI.Cell(7, 1).Merge(DTI.Cell(7, 9)); DTI.Cell(8, 1).Merge(DTI.Cell(8, 9)); DTI.Cell(9, 1).Merge(DTI.Cell(9, 3)); DTI.Cell(9, 2).Merge(DTI.Cell(9, 3)); DTI.Cell(9, 3).Merge(DTI.Cell(9, 4)); DTI.Cell(9, 4).Merge(DTI.Cell(9, 5)); DTI.Cell(10, 1).Merge(DTI.Cell(10, 9)); DTI.Cell(11, 5).Merge(DTI.Cell(11, 9)); DTI.Cell(12, 5).Merge(DTI.Cell(12, 9)); DTI.Cell(11, 1).Merge(DTI.Cell(12, 4)); end_of_doc = get(content,'end'); set(selection,'Start',end_of_doc); selection.TypeParagraph; set(selection, 'Text','主管院长签字: 年 月 日'); set(paragraphformat, 'Alignment','wdAlignParagraphRight'); DTI.Cell(1,1).Range.Text = '课程名称'; DTI.Cell(1,3).Range.Text = '课程号'; DTI.Cell(1,5).Range.Text = '任课教师学院'; DTI.Cell(1,7).Range.Text = '任课教师'; DTI.Cell(2,1).Range.Text = '授课班级'; DTI.Cell(2,3).Range.Text = '考试日期'; DTI.Cell(2,5).Range.Text = '应考人数'; DTI.Cell(2,7).Range.Text = '实考人数'; DTI.Cell(3,1).Range.Text = '出卷方式'; DTI.Cell(3,3).Range.Text = '阅卷方式'; DTI.Cell(3,5).Range.Text = '选用试卷A/B'; DTI.Cell(3,7).Range.Text = '考试时间'; DTI.Cell(4,1).Range.Text = '考试方式'; DTI.Cell(4,3).Range.Text = '平均分'; DTI.Cell(4,5).Range.Text = '不及格人数'; DTI.Cell(4,7).Range.Text = '及格率'; DTI.Cell(5,1).Range.Text = '成绩分布'; DTI.Cell(5,2).Range.Text = '90分以上 人占 %'; DTI.Cell(5,3).Range.Text = '80---89分 人占 %'; DTI.Cell(6,2).Range.Text = '70--79分 人占 %'; DTI.Cell(6,3).Range.Text = '60---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'; 还有,这个程序创造WORD文件后,在MATLAB中的变量"Word"的参数如ActiveDocument,ActivePrinter都是什么意思.谢谢了 |
![]() |
![]() |
![]() |
#2 |
普通会员
注册日期: 2007-08-07
帖子: 64
声望力: 20 ![]() |
![]()
ActiveDocument是当前文档,ActivePrinter可能是控制打印的属性,虽然这个程序是我做的,可是word的很多属性我也没搞明白。
|
![]() |
![]() |
![]() |
主题工具 | |
显示模式 | |
|
|
![]() |
||||
主题 | 主题作者 | 版面 | 回复 | 最后发表 |
求:3次均匀B样条曲线的matlab程序 | solover | MATLAB论坛 | 0 | 2009-02-26 20:28 |
哥猜-张俊龙发现:白文章(游客) 推不动历史的倒车 | 龙舞山威 | 数学 | 0 | 2009-02-13 09:43 |
[求助]如何只打开Help | lyzhan | MATLAB论坛 | 0 | 2008-11-23 11:10 |
"一个累积求和的问题",请教高手 | spurs001 | MATLAB论坛 | 0 | 2008-05-27 09:53 |
【求助】有用matlab做过串口的么? | gooout | MATLAB论坛 | 0 | 2007-07-24 10:48 |