這是我試圖將數據保存到excel中的代碼,但是在數據保存後,頁面凍結,無法重定向到其他頁面。將數據保存到excel後重新加載aspx頁面
public void Save(Literal L)
{
Response.ContentType =
"application/ms-excel";
Response.AddHeader("content-disposition", "attachment; filename=Report.xls");
Response.Write("<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">");
Response.Write("<head>");
Response.Write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1252\">");
Response.Write("<!--[if gte mso 9]>");
Response.Write("<xml>");
Response.Write("<x:ExcelWorkbook>");
Response.Write("<x:ExcelWorksheets>");
Response.Write("<x:ExcelWorksheet>");
//this line names the worksheet
Response.Write("<x:Name>Report</x:Name>");
Response.Write("<x:WorksheetOptions>");
//these 2 lines are what works the magic
Response.Write("<x:Panes>");
Response.Write("</x:Panes>");
Response.Write("</x:WorksheetOptions>");
Response.Write("</x:ExcelWorksheet>");
Response.Write("</x:ExcelWorksheets>");
Response.Write("</x:ExcelWorkbook>");
Response.Write("</xml>");
Response.Write("<![endif]-->");
Response.Write("</head>");
Response.Write("<body>");
Response.Write(L.Text);
Response.Write("</body>");
Response.Write("</html>"); }
目前尚不清楚你想要問什麼?請詳細說明你的問題有點多.. –
這是通過對此我試着保存代碼數據轉換爲excel,但在數據保存後,頁面凍結,無法重定向到其他頁面。 – user3148561