本文实例为大家分享了C#根据Word模版生成Word文的具体代码,供大家参考,具体内容如下
1、指定的word模版
2、生成word类
添加com Microsoft word 11.0 Object Library 引用
using System;
using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;
using Word = Microsoft.Office.Interop.Word;
using System.IO;
namespace Headfree.DefUI
{
public class WordUtility
{
private object tempFile = null;
private object saveFile = null;
private static Word._Document wDoc = null; //word文档
private static Word._Application wApp = null; //word进程
private object missing = System.Reflection.Missing.Value;
public WordUtility(string tempFile, string saveFile)
{
this.tempFile = Path.Combine(Application.StartupPath, @tempFile);
this.saveFile = Path.Combine(Application.StartupPath, @saveFile);
}
///
/// 模版包含头部信息和表格,表格重复使用
///
/// 重复表格的数据
///