资源简介
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#版
- 比较图片相似度技术
- c# 断点上传
- C# winform简单易用的异步加载Loading效果
- 仓库管理系统源码C#
- C#学习之—五子棋源代码
- 超炫C# loading
- C#版图像处理界面,包含二值化、灰度
-
基于C#和xm
l的自动化测试框架系统的 - c# 获取CPU温度(非WMI,直接读取硬件
- C# httplistener 简单的高并发http服务器
- C# 读取word文档和图片
- C# 调用 bartender 打印的二次开发,含说
- MIKROTIK ROS API C#版,支持中文备注
- C#远程连接SQLserver 数据库
- C#从入门到精通第4版明日科技2017年
- C#调用主板蜂鸣器发声,Win7x64可用!
- c#企业人力资源管理系统源码
- C#中checkboxList控件用法总结
- c# 设置ip代理
- C#编写Modbus TCP客户端程序
- C#多线程编程 线程与窗体交互源码
- C# .Net Socket TCP 大数据 大文件 传输 经
- c# winform 用鼠标画拉出来的虚线框鼠标
- c# 如何删除datagridview中数据并删除数
- 用C#模仿银行ATM自动取款机系统
- C#读取AD域组织架构及用户
- asp.net用OpenPop.dll获取邮件列表和内容
- ESP8266 调试工具 C#开发
- C#资源\\修改文件备注源码
评论
共有 条评论