6
我必须导出数据以查看Excel中,其实我已经实现了,但我的疑问是,当 使用导出Excel文件来查看(MVC)
return new FileContentResult(fileContents, "application/vnd.ms-excel");
VS
return File(fileContents, "application/vnd.ms-excel");
以及如何在每种方法中设置可下载的文件名?
例1:
public ActionResult ExcelExport()
{
byte[] fileContents = Encoding.UTF8.GetBytes(data);
return new FileContentResult(fileContents, "application/vnd.ms-excel");
}
举例:2
public ActionResult ExcelExport()
{
byte[] fileContents = Encoding.UTF8.GetBytes(data);
return File(fileContents, "application/vnd.ms-excel");
}