用C#实现word文档合并
来源:互联网 发布:sql批量删除存储过程 编辑:程序博客网 时间:2024/04/28 05:41
现在要实现这个功能,先拷贝一段代码过来,
再试验能不能用。
public static void MergeDocoument( )
{
strTemplateName = HttpContext.Current.Server.MapPath("../VAULTS/"+nTemplateID.ToString()+"/"+strTemplateName+".doc" );
object falseValue = false;
object missing = System.Reflection.Missing.Value;
object TemplateFileName = strTemplateName;
Word.Application wordApp = new Word.ApplicationClass();
Word.Document wordDoc = wordApp.Documents.Add(ref missing, ref missing,ref missing, ref missing);
wordDoc.Activate();
string strFileName = string.Empty;
wordApp.Selection.InsertFile( strFileName,ref missing,ref falseValue,ref falseValue,ref falseValue);
wordDoc.SaveAs(ref TemplateFileName,ref missing, ref missing,ref missing, ref missing,ref missing, ref missing,ref missing, ref missing,ref missing, ref missing,ref missing, ref missing,ref missing, ref missing,ref missing);
wordDoc.Close(ref missing, ref missing, ref missing);
wordApp.Quit(ref missing, ref missing, ref missing);
if ( wordDoc != null )
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(wordDoc);
wordDoc = null;
}
if ( wordApp != null )
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(wordApp);
wordApp = null;
}
GC.Collect();
}
不是我写的哎,是我马上要用,先试验能不能用。再把问题贴出来
- 用C#实现word文档合并
- C# 合并word文档
- 实现word文档合并
- 用C#来合并WORD文档
- 用C#编程合并多个WORD文档
- 用C#编程合并多个WORD文档
- 小技巧:用C#编程合并多个WORD文档
- 用C#编程合并多个WORD文档
- C# 合并及拆分Word文档
- C# 实现多种Word邮件合并功能
- 批量合并word文档
- word 文档合并
- WORD文档合并方法
- 批量合并word文档
- 黄聪:C#操作合并多个Word文档
- 用C#实现在Word文档中搜索文本
- 用C#实现在Word文档中搜索文本
- 用C#实现在Word文档中搜索文本
- Java finalize() 方法 -Java 学习笔记 (18)
- WDSL中的XML元素
- 用AnimateWindow函数实现窗口动画效果
- 需求分析的20条法则(上)
- 《Python网络编程基础》中文版简评
- 用C#实现word文档合并
- 使用事件监听器
- C#调用DOS命令方法
- 二零零七年五一节自驾游记(六)--------0501红原II
- asp弹出对话框方法
- 古生物连连看beta1.0六月底测试,欢迎各位亲朋好友来捧场!嘻嘻
- 读书的心情总是那么好,心情愉悦
- C++Builder利用URLDownloadToFile下载文件并显示进度
- 毕业了,工作了!以后写一些东西!