资源简介
通过vsto自动生成word文档,通过dot自动生成word文档、插入数据;解决启动多word进程冲突问题
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Core;
using Microsoft.Office.Interop.Word;
namespace NmdsyCooperationManagement.GenerateWord
{
public class CCWordApp
{
private static Microsoft.Office.Interop.Word.ApplicationClass oWordApplic=new ApplicationClass(); // a reference to Word application
private Microsoft.Office.Interop.Word._Document oDoc; // a reference to the document
public CCWordApp()
{
// activate the interface with the COM object of Microsoft Word
// oWordApplic = new Microsoft.Office.Interop.Word.ApplicationClass();
}
// Open a file (the file must exists) and activate it
public void Open(string strFileName)
{
object fileName = strFileName;
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
oDoc = oWordApplic.Application.Documents.Add(ref fileName ref missing ref missing ref missing);
//oDoc = oWordApplic.Documents.Open(ref fileName ref missing ref readOnly
// ref missing ref missing ref missing ref missing ref missing ref missing
// ref missing ref missing ref isVisible ref missing ref missing ref missing ref missing);
//oDoc.Activate();
}
// Open a new document
public void Open()
{
object missing = System.Reflection.Missing.Value;
oDoc = oWordApplic.Documents.Add(ref missing ref missing ref missing ref missing);
//oDoc.Activate();
}
public void InsertBookmarkText(string bookmarknamestring text)
{
object missing = System.Reflection.Missing.Value;
object Bookmark = (int)Microsoft.Office.Interop.Word.WdGoToItem.wdGoToBookmark;
object NameBookMark = bookmarkname;
//Bookmark bm= oDoc.Bookmarks.get_Item(ref NameBookMark) as Bookmark;
//bm.Select();
//bm.Select();
oDoc.GoTo(ref Bookmark ref missing ref missing ref NameBookMark).Text = text;
// oDoc.GoTo(ref Bookmark ref missing ref missing ref NameBookMark);
// oWordApplic.Selection.GoTo(ref Bookmark ref missing ref missing ref NameBookMark);
}
public void Quit()
{
object missing = System.Reflection.Missing.Value;
object SaveChange = Microsoft.Office.Interop.Word.WdSaveOptions.wdSaveChanges;
oDoc.Close(ref SaveChange ref missing ref missing);
//oWordApplic.Application.
// oWordApplic.Quit(ref missing ref missing ref missing);
//oWordApplic.Quit(ref missing ref missing ref missing);
//oWordApplic.Applicat
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 662120 2007-10-10 09:48 NmdsyCooperationManagement.GenerateWord\bin\Debug\Microsoft.Office.Interop.Word.dll
文件 64088 2007-10-10 09:48 NmdsyCooperationManagement.GenerateWord\bin\Debug\Microsoft.Vbe.Interop.dll
文件 8704 2009-10-22 15:14 NmdsyCooperationManagement.GenerateWord\bin\Debug\NmdsyCooperationManagement.GenerateWord.dll
文件 22016 2009-10-22 15:14 NmdsyCooperationManagement.GenerateWord\bin\Debug\NmdsyCooperationManagement.GenerateWord.pdb
文件 223800 2007-10-10 09:48 NmdsyCooperationManagement.GenerateWord\bin\Debug\Office.dll
文件 13197 2009-10-22 15:14 NmdsyCooperationManagement.GenerateWord\CCWordApp.cs
文件 266 2009-10-21 10:27 NmdsyCooperationManagement.GenerateWord\mssccprj.scc
文件 2938 2009-10-21 14:09 NmdsyCooperationManagement.GenerateWord\NmdsyCooperationManagement.GenerateWord.csproj
文件 305 2009-10-20 17:39 NmdsyCooperationManagement.GenerateWord\NmdsyCooperationManagement.GenerateWord.csproj.vspscc
文件 1366 2009-10-21 14:32 NmdsyCooperationManagement.GenerateWord\obj\Debug\NmdsyCooperationManagement.GenerateWord.csproj.FileListAbsolute.txt
文件 8704 2009-10-22 15:14 NmdsyCooperationManagement.GenerateWord\obj\Debug\NmdsyCooperationManagement.GenerateWord.dll
文件 22016 2009-10-22 15:14 NmdsyCooperationManagement.GenerateWord\obj\Debug\NmdsyCooperationManagement.GenerateWord.pdb
文件 4096 2009-10-20 14:40 NmdsyCooperationManagement.GenerateWord\obj\Debug\Refactor\NmdsyCooperationManagement.GenerateWord.dll
文件 8821 2009-10-22 09:02 NmdsyCooperationManagement.GenerateWord\obj\Debug\ResolveAssemblyReference.cache
文件 1470 2009-10-20 11:26 NmdsyCooperationManagement.GenerateWord\Properties\AssemblyInfo.cs
....SHR 176 2009-10-20 17:39 NmdsyCooperationManagement.GenerateWord\Properties\vssver2.scc
....SHR 295 2009-10-22 15:19 NmdsyCooperationManagement.GenerateWord\vssver2.scc
文件 3606 2009-10-21 17:35 NmdsyCooperationManagement.GenerateWord\WordApp.cs
目录 0 2009-10-20 14:40 NmdsyCooperationManagement.GenerateWord\obj\Debug\Refactor
目录 0 2009-10-20 11:26 NmdsyCooperationManagement.GenerateWord\obj\Debug\TempPE
目录 0 2009-10-21 14:32 NmdsyCooperationManagement.GenerateWord\bin\Debug
目录 0 2009-10-22 15:14 NmdsyCooperationManagement.GenerateWord\obj\Debug
目录 0 2009-10-20 11:52 NmdsyCooperationManagement.GenerateWord\bin
目录 0 2009-10-20 11:26 NmdsyCooperationManagement.GenerateWord\obj
目录 0 2009-10-20 17:39 NmdsyCooperationManagement.GenerateWord\Properties
目录 0 2009-10-22 15:14 NmdsyCooperationManagement.GenerateWord
----------- --------- ---------- ----- ----
1047984 26
- 上一篇:i2c_ioctl详解
- 下一篇:有关人脸检测的源代码和基于肤色的
相关资源
- DigitalDisplay(数字显示)
- Img2Lcd4.0破解版自动生成二维数组形式
- 常微分方程 王高雄主编 第三版 高等
- Word2TeX 注册破解版 Word转Tex软件 doc转
- powerword 新英格兰39节点系统
- GPS中误差计算
- win10中公式编辑器MT Extra字体
- 考试系统中Word操作题自动阅卷的实现
- word文件查重工具
- 遥感图像中机场跑道检测算法的研究
- 数据结构课程设计 校园导航(含源程
- 一维码生成BarcodeLib.dll 和 zxing.dll生成
- 基于Udp的五子棋对战游戏
- 我是一只IT小小鸟(word版+txt版)合集
- LibUsbDotNet 例程
- 高斯坐标正反算
- 中文停用词库 chineseStopWords.txt
- 自动生成文件夹目录
- freemaker导出单个word格式doc.rar
- 航班管理系统
- 完美破解word文档打开密码
- windowsService--实现文本的定时写数据操
- Game Of Life
- Head First 系列丛书网盘资源
- Spring Boot 系列教程 freemarker导出word
- 计算机组成原理课后习题答案Word版
- 书店管理系统窗体程序
- 计算机应用个人简历word模板
- 从零开始:AE二次开发中获取A点到B点
- ChartControl控件的使用
评论
共有 条评论