首先创建DOC模板
再次,在项目中相关页面添加此重点方法
重点方法:
private string PrintWord()
{
try
{
string templatePath = _SaveDocPath + "/Template/RPMB.doc";
//生成的文档路径
filePath = _SaveDocPath + "/HZM/";
if (!Directory.Exists(filePath))
Directory.CreateDirectory(filePath);
if (!File.Exists(templatePath)) return "error:服务器没有模版";
filePath = filePath + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc";
//copy一份
File.Copy(templatePath, filePath, true);
object oMissing = System.Reflection.Mi