![](/img/trans.png)
[英]Having trouble connecting to a SQL Server database file. What am I doing wrong?
[英]I am having trouble swapping a file. From XLS to XLSX
我正在尝试对应用程序代码进行更改,因为无论如何我已经尝试过了,但我没有成功。 我的系统上有一个报告选项卡,但它只导出XLS文件,我需要切换到XLSX,因为XLS限制为65,000行。 当他安装XLS时,我会展示我的控制器的一部分。 我无法显示我的服务方法,因为它非常大而且你会丢失。
[CustomAuthorize(TipoFuncao.PRINT)]
public ActionResult Index(FiltroRptManifesto filtro)
{
byte[] result = null;
bool overflowMonth = false;
IWorkbook workbook = new XSSFWorkbook();
try
{
RptManifestoService rptManifestoService = new RptManifestoService(ModelState);
result = rptManifestoService.GeraExcel(Server.MapPath("~/Content/RptManifesto.xls"), filtro, ViewBag.Usuario);
if (ModelState.IsValid)
{
if (ValidateDate(ModelState["DtProtocoloIni"].Value, ModelState["DtProtocoloFin"].Value).Days > 540)
{
overflowMonth = true;
throw new Exception();
};
Response.AppendCookie(new HttpCookie("downloadToken", filtro.DownloadToken));
return File(result, "application/vnd.ms-excel", "Manifesto.xls");
}
}
//...
我从来没有使用过NPOI所以我可能错了,但如果你这样做会发生什么:
var fileName = "Manifesto.xlsx";
return File(result, MimeMapping.GetMimeMapping(fileName), fileName);
要么
return File(
result,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"Manifesto.xlsx");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.