文件名称:WordOperateClass
- 所属分类:
- Windows编程
- 资源属性:
- [Windows] [Visual.Net] [Basic/ASP] [源码]
- 上传时间:
- 2016-05-27
- 文件大小:
- 9kb
- 下载次数:
- 0次
- 提 供 者:
- 元*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
C#word(2007)操作类 新建文档、添加页眉页脚、设置格式、添加文本和超链接、添加图片、表格处理、文档格式转化-public static bool CreateWordFile(string dir, string fileName)
{
try
{
Object oMissing = System.Reflection.Missing.Value
if (!Directory.Exists(dir))
{
//创建文件所在目录
Directory.CreateDirectory(dir)
}
//创建Word文档(Microsoft.Office.Interop.Word)
Microsoft.Office.Interop.Word._Application WordApp = new Application()
WordApp.Visible = true
Microsoft.Office.Interop.Word._Document WordDoc = WordApp.Documents.Add(
ref oMissing, ref oMissing, ref oMissing, ref oMissing)
//保存
object filename = dir+ fileName
WordDoc.SaveAs(ref filename, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing)
WordDoc.Close(ref oMissing, ref oMissing, ref oMissing)
Wor
{
try
{
Object oMissing = System.Reflection.Missing.Value
if (!Directory.Exists(dir))
{
//创建文件所在目录
Directory.CreateDirectory(dir)
}
//创建Word文档(Microsoft.Office.Interop.Word)
Microsoft.Office.Interop.Word._Application WordApp = new Application()
WordApp.Visible = true
Microsoft.Office.Interop.Word._Document WordDoc = WordApp.Documents.Add(
ref oMissing, ref oMissing, ref oMissing, ref oMissing)
//保存
object filename = dir+ fileName
WordDoc.SaveAs(ref filename, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing)
WordDoc.Close(ref oMissing, ref oMissing, ref oMissing)
Wor
(系统自动生成,下载前可以参看下载内容)
下载文件列表
WordOperate.cs