操作Word文档超详细操作总结大全.doc

操作Word文档超详细操作总结大全.doc

ID:57681096

大小:52.00 KB

页数:10页

时间:2020-08-31

操作Word文档超详细操作总结大全.doc_第1页
操作Word文档超详细操作总结大全.doc_第2页
操作Word文档超详细操作总结大全.doc_第3页
操作Word文档超详细操作总结大全.doc_第4页
操作Word文档超详细操作总结大全.doc_第5页
资源描述:

《操作Word文档超详细操作总结大全.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、前提工作:UsingMicrosoft.Office.Interop.Word;MicrosoftOffice11.0ObjectLibrary;必要实例化的两个类:Microsoft.Office.Interop.Word.Applicationmyword=newMicrosoft.Office.Interop.Word.Application();//对word软件的操作Microsoft.Office.Interop.Word.Documentmydoc=newMicrosoft.Office.Interop.Word.Document

2、();//对word软件中文本的操作Microsoft.Office.Interop.Word.Rangemyrange=myword.Application.Selection.Range;//对word软件中文本字体设置的操作Microsoft.Office.Interop.Word.InlineShapeshape=myword.ActiveWindow.ActivePane.Selection.InlineShapes.AddPicture(“图片地址”,Nothing,Nothing,Nothing);//页眉插入图片Microsof

3、t.Office.Interop.Word.PageNumbersPns=myword.Selection.Sections[1].Headers[WdHeaderFooterIndex.wdHeaderFooterEvenPages].PageNumbers;//获取当前页码myword.Selection和myword.Application.Selection//两者使用相同,Application指向的是Word应用程序经常使用变量:ObjectNothing=System.Reflection.Missing.Value;//选参数的

4、默认参数Objectunite=WdUnits.wdStory;//word场景范例:①myword.selection.EndKey(refunite,refNoThing);常用的方法和属性:①Word引用常用的方法:/*文档集指向Word的文档*/mydoc=myWord.Document.Add(refNothing,refNothing,refNothing,refNothing);//文档集指向word文档mydoc.Activate();//激活mydoc指定对象/*Word文档操作*/Objectpath=“本机保存文件地址”;

5、Objectformat003=WdSaveFormat.wdFormatDocument;//指定保存的格式mydoc.SaveAs(refpath,refformat003,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing);//保存word文档mydoc.SaveAs2(refpath

6、,refformatPDF,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing,refNothing);//保存word文档SaveAs(..)函数和SaveAs2(..)函数的区别:SaveAs2(..)只适用在Word2010项目中。解释:该函数功能为word文件另存为到本机硬盘中,在有指定存储格式的时候不需要追加“后缀名”字符串额外知识体系:{WdSaveFormat类的格式常用属性表wdfor

7、matdocument微软Word格式。wdformatdostext微软文本格式。wdformatdostextlinebreaks微软DOS文本保存换行符。wdformatencodedtext编码文本格式。wdformatfilteredhtml过滤HTML格式。wdformathtml标准HTML格式。wdformatrtf富文本格式(RTF)。wdformattemplate微软Word模板格式。wdformattext微软视窗文本格式。wdformattextlinebreaks微软Windows文本格式保留换行符。wdformat

8、unicodetext文本格式。wdformatwebarchive网络归档格式。wdformatxml可扩展标记语言(XML)格式。mydoc.Co

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。