如何使用c#创建包含多个工作表的excel文件
本文关键字:excel 文件 工作 何使用 创建 包含多 | 更新日期: 2023-09-27 18:04:48
这样我创建了一个excel文件,但是我有两个视图,我想在同一个文件中生成两个工作表。对不起,我的英语不好。
public ActionResult DescargarExportableDepreciacionTributaria()
{
System.IO.StringWriter sw = new System.IO.StringWriter();
Response.AddHeader("Content-Type", "application/vnd.ms-excel");
Response.AddHeader("Charset", "UTF-8");
Response.AddHeader("Content-Disposition","attachment; filename=re"+ ".xls");
string style = @"<style> .text { mso-number-format:'@; } </style> ";
ViewBag.Id = Request.Params["Id"];
Response.Write(@"<style> TD.text { mso-number-format:'@; } </style>");
return View("ContenidoExportable");
}
您可能需要检查ClosedXML。它可以帮助您轻松地使用库