我正在创建.doc文件,但它只用字符串创建,没有设计正在应用。只是简单的字符串进入.doc文件
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
System.Xml.XmlDocument dom = new System.Xml.XmlDocument();
design.RenderControl(htmlWrite);
string strBuilder = stringWrite.ToString().Replace("&", "&");
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc.LoadXml(strBuilder);
string rawText = xmlDoc.InnerText;
string strPath = Request.PhysicalApplicationPath + "\\Temp\\WeeklyReport of " + Projname + ".doc";
var doc = DocX.Create(strPath,DocumentTypes.Document);
doc.InsertParagraph(rawText);
doc.Save();