在我的ASP.Net應用程序中,我使用XSLT樣式表。
Response.Clear();
Response.AddHeader("Content-Disposition", "inline; filename=filename.xls");
Response.ContentType = "application/vnd.ms-excel";
System.Xml.XmlDocument xslDoc = new System.Xml.XmlDocument();
xslDoc.Load(System.Web.HttpContext.Current.Server.MapPath("~\\App_Data\\my_xslt_template.xslt"));
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc.LoadXml(ValuesDS.GetXml());
System.Xml.Xsl.XslTransform xslt = new System.Xml.Xsl.XslTransform();
xslt.Load(xslDoc);
using (System.IO.StringWriter writer = new System.IO.StringWriter())
{
xslt.Transform(xmlDoc, null, writer, null);
Response.Write(writer.ToString());
}
Response.End();
你嘗試過什麼嗎? –
是的,只有微軟Office Interop API,但我不想用com object.pls讓我知道如果你對我的場景有任何想法.. – user2717258
你想創建一個excel文件而不使用excel?祝你好運... – DoctorMick