womendu 发表于 2013-1-27 12:57:01

vb.net创建一个word文档并保存

引用:
Microsoft Word 11.0 Object Library
Microsoft Office 11.0 Object Library
代码如下:
<div style="padding-right: 5.4pt; padding-left: 5.4pt; background: #e6e6e6; padding-bottom: 4px; width: 95%; padding-top: 4px;">http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gifImportsMicrosoft.Office.Interop
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gifPublicClassForm1ClassForm1
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gifhttp://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gifPrivateSubButton1_Click()SubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.Click
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifDimm_objAsObject=System.Reflection.Missing.Value
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifDimappAsNewWord.Application
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifDimdocAsWord._Document
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifTry
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifdoc=CType(app.Documents.Add(m_obj),Word._Document)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifapp.Selection.TypeText("我是塞北的雪http://blog.csdn.net/precipitant")
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifdoc.SaveAs("c:NorthSnow.doc")
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifdoc.Close()
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifapp=Nothing
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifMsgBox("创建word完毕")
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifCatchexAsException
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifMsgBox(ex.Message)
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gifEndTry
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gifEndSub
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gifEndClass
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif
页: [1]
查看完整版本: vb.net创建一个word文档并保存