public void ExportToExcelDepartmentAverageMark(string departmentId, string reportType, string dateValue, Guid?parentId) { Guid?department; if (departmentId == "*") { department = null; } else { department = Guid.Parse(departmentId); } var dates = dateValue.Split(',').ToArray(); DateTime[] dateValues = new DateTime[] { DateTime.ParseExact(dates[0], "MM/dd/yyyy", CultureInfo.InvariantCulture), DateTime.ParseExact(dates[1], "MM/dd/yyyy", CultureInfo.InvariantCulture) }; XlsReport report = new XlsReport(unit, department, reportType, dateValues, parentId); ExcelPackage package = report.FormReport(); Response.Clear(); Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attachment: filename=ExcelReport.xlsx"); Response.BinaryWrite(package.GetAsByteArray()); Response.End(); }
public void ExportToExcel(string departmentId, string reportType, DateTime dateValue, Guid?parentId) { Guid?department; if (departmentId == "*") { department = null; } else { department = Guid.Parse(departmentId); } XlsReport report = new XlsReport(unit, department, reportType, dateValue, parentId); ExcelPackage package = report.FormReport(); Response.Clear(); Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attachment: filename=ExcelReport.xlsx"); Response.BinaryWrite(package.GetAsByteArray()); Response.End(); }