word2007創建域:插入文檔部件——域——{DOCPROPERTY Bytes \*火辣}
//導入模板
g_document = DocX.Load(Server.MapPath(@"~\\UploadImages\\空調租賃協議模板.docx"));
g_document = CreateInvoiceTemplate(DocX.Load(Server.MapPath(@"~\\UploadImages\\空調租賃協議模板.docx")), cc);
//保存在服務器上
g_document.SaveAs(Server.MapPath(@"~\\UploadImages\空調租賃協議Temp.docx"));
//爲模板填充數據
private DocX CreateInvoiceTemplate(DocX template, WordModel vv)
{
template.AddCustomProperty(new CustomProperty("域名字", 值));
template.AddCustomProperty(new CustomProperty("StuDorm", _dorm));
template.AddCustomProperty(new CustomProperty("NowDate", DateTime.Now.ToShortDateString()));
}