创建Word文档 private Word.Application G_wa;//定义Word应用程序字段 private object G_missing = //定义G_missing字段并添加引用 System.Reflection.Missing.Value; private FolderBrowserDialog G_FolderBrowserDialog;//定义浏览文件夹字段 private object G_str_path;//定义文件保存路径字段 private void btn_New_Click(object sender, EventArgs e) { btn_New.Enabled = false;//将新建按钮设置为不可用 ThreadPool.QueueUserWorkItem(//开始线程池 (pp) =>//使用lambda表达式 { //CodeGo.net/ G_wa = new Microsoft.Office.Interop.Word.Application();//创建应用程序对象 object P_obj = "Normal.dot";//定义文档模板 Word.Document P_wd = G_wa.Documents.Add(//向Word应用程序中添加文档 ref P_obj, ref G_missing, ref G_missing, ref G_missing); G_str_path = string.Format(//计算文件保存路径 @"{0}\{1}", G_FolderBrowserDialog.SelectedPath, DateTime.Now.ToString("yyyy年M月d日h时s分m秒fff毫秒") + ".doc"); P_wd.SaveAs(//保存Word文件 ref G_str_path, ref G_missing, ref G_missing, ref G_missing, ref G_missing, ref G_missing, ref G_missing, ref G_missing, ref G_missing, ref G_missing, ref G_missing, ref G_missing, ref G_missing, ref G_missing, ref G_missing, ref G_missing); ((Word._Application)G_wa.Application).Quit(//退出应用程序 ref G_missing, ref G_missing, ref G_missing); this.Invoke(//调用窗体线程 (MethodInvoker)(() =>//使用lambda表达式 { MessageBox.Show(//提示已经创建Word "成功创建Word文档!", "提示!"); btn_display.Enabled = true;//启用显示按钮 })); }); }
[quote=引用 7 楼 Hsuifengershi 的回复:] C#在WORD 里面画带箭头的线 高手进 100~~散了 [问题点数:100分,结帖人liangqingxing] http://bbs.csdn.net/topics/240022275 就找到了一个
C#在WORD 里面画带箭头的线 高手进 100~~散了 [问题点数:100分,结帖人liangqingxing] http://bbs.csdn.net/topics/240022275 就找到了一个
C# NOPI控件
msdn 都帮不了你么
http://blog.sina.com.cn/s/blog_74fe278f0101g75c.html
110,566
社区成员
642,567
社区内容
加载中
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧