资源简介
http://blog.csdn.net/zengweiqiang/article/details/6872259
根据这篇博客做出来的可运行程序和源码。
用vs2010写的

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Word = Microsoft.Office.Interop.Word;
using System.IO;
using System.Diagnostics;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private static Word._Document wDoc = null;
private static Word._Application wApp = null;
string[] sReplace;
private void button1_Click(object sender EventArgs e)
{
Word.Application thisApplication = new Word.ApplicationClass();
wApp = thisApplication;
string tmpDocFile = Directory.GetCurrentDirectory() + @“\template.doc“;
object templatefile = tmpDocFile;
object missing =System.Reflection.Missing.Value ;
//object missing = Type.Missing;
wDoc = wApp.Documents.Add(ref templatefile ref missing ref missing ref missing);
wDoc.Activate();
//object replaceAll = Word.WdReplace.wdReplaceAll;
for (int i = 0; i {
object replaceAll = Word.WdReplace.wdReplaceOne;
wApp.Selection.Find.ClearFormatting();
wApp.Selection.Find.Text = “***“;
wApp.Selection.Find.Format = true;
wApp.Selection.Find.MatchByte = true;
wApp.Selection.Find.Wrap = Word.WdFindWrap.wdFindAsk;
wApp.Selection.Find.Replacement.ClearFormatting();
wApp.Selection.Find.Replacement.Text = sReplace[i];
wApp.Selection.Find.Execute(ref missing ref missing ref missing ref missing ref missing
ref missing ref missing ref missing ref missing ref missing
ref replaceAll ref missing ref missing ref missing ref missing);
}
object background = false;
object filename = Directory.GetCurrentDirectory() + @“\t.doc“;
wDoc.SaveAs2(ref 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);
wDoc.PrintOut(ref background 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 ref missing
ref missing);
object saveOPtion = Word.WdSaveOptions.wdSaveChanges;
wDoc.Close(ref saveOPtionref missingref missing );
s
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-03-19 17:00 WindowsFormsApplication1\
目录 0 2014-03-19 15:50 WindowsFormsApplication1\WindowsFormsApplication1\
文件 2106 2014-03-19 18:46 WindowsFormsApplication1\WindowsFormsApplication1\Form1.Designer.cs
文件 3848 2014-03-19 18:47 WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs
文件 5817 2014-03-19 18:46 WindowsFormsApplication1\WindowsFormsApplication1\Form1.resx
文件 2048 2014-03-19 14:33 WindowsFormsApplication1\WindowsFormsApplication1\Form2.Designer.cs
文件 3189 2014-03-19 14:33 WindowsFormsApplication1\WindowsFormsApplication1\Form2.cs
文件 5817 2014-03-19 14:33 WindowsFormsApplication1\WindowsFormsApplication1\Form2.resx
文件 505 2014-03-19 15:40 WindowsFormsApplication1\WindowsFormsApplication1\Program.cs
目录 0 2014-03-18 17:13 WindowsFormsApplication1\WindowsFormsApplication1\Properties\
文件 1398 2014-03-18 17:13 WindowsFormsApplication1\WindowsFormsApplication1\Properties\AssemblyInfo.cs
文件 2900 2014-03-18 17:13 WindowsFormsApplication1\WindowsFormsApplication1\Properties\Resources.Designer.cs
文件 5612 2014-03-18 17:13 WindowsFormsApplication1\WindowsFormsApplication1\Properties\Resources.resx
文件 1111 2014-03-18 17:13 WindowsFormsApplication1\WindowsFormsApplication1\Properties\Settings.Designer.cs
文件 249 2014-03-18 17:13 WindowsFormsApplication1\WindowsFormsApplication1\Properties\Settings.settings
文件 4999 2014-03-19 17:24 WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1.csproj
目录 0 2014-03-19 18:48 WindowsFormsApplication1\WindowsFormsApplication1\bin\
目录 0 2014-03-19 16:55 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\
文件 11776 2014-03-19 16:42 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
文件 28160 2014-03-19 16:42 WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
目录 0 2014-03-18 17:13 WindowsFormsApplication1\WindowsFormsApplication1\obj\
目录 0 2014-03-18 17:13 WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\
目录 0 2014-03-19 18:48 WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\
文件 789 2014-03-18 17:13 WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6575 2014-03-19 18:48 WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
目录 0 2014-03-19 18:49 WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\TempPE\
文件 180 2014-03-19 18:46 WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.Form1.resources
文件 180 2014-03-19 17:29 WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.Form2.resources
文件 180 2014-03-19 17:29 WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.Properties.Resources.resources
文件 1848 2014-03-19 17:19 WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.csproj.FileListAbsolute.txt
文件 1091 2014-03-19 18:46 WindowsFormsApplication1\WindowsFormsApplication1\obj\x86\Debug\WindowsFormsApplication1.csproj.GenerateResource.Cache
............此处省略7个文件信息
相关资源
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- Winform可视化打印模板设计工具含源码
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
- C# 使用ListView控件实现图片浏览器(源
- C#简单窗体聊天程序
- C#指纹识别系统程序 报告
评论
共有 条评论