用代码生成并保存word问题

aith1986 2009-03-19 10:54:31

//用了一个word操作类
WordClass MyWord = new WordClass();
//类里的保存和关闭函数,在word文档编辑好后使用的
MyWord.SaveAs(str_Path);
MyWord.Close();

//两个函数在类里的原型
#region Save & SaveAs
public void Save()
{
if (m_Document != null)
m_Document.Save();
}
public void SaveAs(string fileName)
{
object obj_FileName = fileName;
if (m_Document != null)
{
m_Document.SaveAs(ref obj_FileName, 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);
}
}
#endregion



#region Close
public void Close()
{
object saveChanges = WdSaveOptions.wdSaveChanges;
if (m_Document != null)
m_Document.Close(ref saveChanges, ref missing, ref missing);
}
#endregion



为什么在每次关机的时候总显示 是否保存文档1,取消后又跳出是否保存文档2 执行过几回就要出现几个
这是怎么回事啊
...全文
145 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
aith1986 2009-03-24
  • 打赏
  • 举报
回复
谁能帮帮我啊
aith1986 2009-03-23
  • 打赏
  • 举报
回复
谢谢楼上的兄弟们
再问哈,每次调用都会产生一个WinWord.exe进程
除了强行杀掉,还有其他方法吗
aith1986 2009-03-19
  • 打赏
  • 举报
回复
关机的时候总是提示是否保存文档1.2...
麻烦,不晓得怎么解决
哪位大虾知道
txws1119 2009-03-19
  • 打赏
  • 举报
回复
我补充一下`~

http://download.csdn.net/source/1027383

代码生成WORD,直接生成文字,段落,字体,表格,图表。
mykelly6 2009-03-19
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 wuyq11 的回复:]
关闭后要通过GC释放资源
http://www.cnblogs.com/fellowcheng/articles/1274276.html
[/Quote]
up
wuyq11 2009-03-19
  • 打赏
  • 举报
回复

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧