varpathHttpContext.Server.MapPath($~Temp文件xls导出{DateTime.Now.ToString(yyyyMMddHHmmssfff var path = HttpContext.Server.MapPath($"~/Temp/文件xls导出{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.xls"); 获取datatable数据... try {
var path = HttpContext.Server.MapPath($"~/Temp/文件xls导出{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.xls");
获取datatable数据...
try { Workbook newBook1 = new Workbook(); newBook1.CreateEmptySheets(1); Worksheet newSheet1 = newBook1.Worksheets[0]; /*写表头*/ newSheet1.Range[1, 1].Text = "序号"; newSheet1.Range[1, 2].Text = "内容1"; newSheet1.Range[1, 3].Text = "内容2"; /*写内容*/ for (int i = 0; i