C# 获取当前word文档

object Nothing = Type.Missing;
      获得当前编辑word对象
Word.Application wordApp =  (Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");

//Word文档变量

Document wordDoc;
// 添加一个新的word文档
//wordDoc = wordApp.Documents.Add(ref Nothing, ref Nothing, ref Nothing, ref Nothing);
// 获取当前编辑的word文档
wordDoc = wordApp.ActiveDocument;

猜你喜欢

转载自blog.csdn.net/MR_WANGCX/article/details/81392468
今日推荐