在使用mvc +npoi方式匯出excel的時候提示

js:
window.location.href = top.$.rootUrl + '/FK_QualityManage/Basic_Material/PrintLabel?BM_Model=' +
BM_Model + '&Count=' + Count + '&BM_Code='+BM_Code;
控制器:
public ActionResult PrintLabel(string BM_Model, string Count,string BM_Code)
{
Stream ms = new MemoryStream();
ms = basic_MaterialIBLL.PrintLabel(BM_Model, Count, BM_Code);
if (ms != null)
{
return File(ms, "application/ms-excel", "Label.xls");
}
else
{
return Fail("列印失敗!");
}
}
這是什么意思,能解決嗎
uj5u.com熱心網友回復:
錯誤是js中 _html 這個沒有定義uj5u.com熱心網友回復:
我以前是直接拼接html匯出excel的。你可以借鑒一下
https://blog.csdn.net/hanjun0612/article/details/54139014
uj5u.com熱心網友回復:
直接下載
using (var exportData = new MemoryStream())
{
Response.Clear();
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment;filename=" + fileName + ".xlsx");
workbook.Write(exportData);
Response.BinaryWrite(exportData.ToArray());
Response.End();
}
uj5u.com熱心網友回復:
除錯下ms = basic_MaterialIBLL.PrintLabel(BM_Model, Count, BM_Code);
這里ms回傳了什么,是excel檔案么
uj5u.com熱心網友回復:

轉載請註明出處,本文鏈接:https://www.uj5u.com/net/21132.html
標籤:ASP.NET
上一篇:為什么我在安裝離線版vs2015時老是卡在可選項那里,然后就會跳出來打包失敗,求求各位幫忙看看怎么回事,謝謝了
下一篇:winform怎么實作這樣的效果
