總結整理word導出

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()));

}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章