导出跳过年月

parent a19c74c2
......@@ -190,6 +190,7 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
string filepath = Path.Combine(dpath, $"{hospital.HosName}-{name}-{DateTime.Now:yyyyMMdd}");
FileHelper.DeleteFile(filepath);
string[] notSum = new string[] { "year", "month" };
using (FileStream fs = new FileStream(filepath, FileMode.OpenOrCreate))
using (ExcelPackage package = new ExcelPackage(fs))
{
......@@ -216,7 +217,7 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
}
if (col == 0)
worksheet.SetValue(dynamics.Count() + 2, col + 1, "合计");
else
else if (!notSum.Contains(headList[col].Name.ToLower()))
worksheet.Cells[dynamics.Count() + 2, col + 1].Formula = string.Format("SUM({0})", new ExcelAddress(2, col + 1, dynamics.Count() + 1, col + 1).Address);
}
......@@ -226,8 +227,8 @@ public string AllComputerViewReport(int allotId, List<dynamic> dynamics, string
worksheet.Row(row).Height = 20;
for (int col = worksheet.Dimension.Start.Column; col <= worksheet.Dimension.End.Column; col++)
{
worksheet.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin);
worksheet.Cells[row, col].Style.Numberformat.Format = "#,##0.00";
worksheet.Cells[row, col].Style.Border.BorderAround(ExcelBorderStyle.Thin);
worksheet.Cells[row, col].Style.VerticalAlignment = ExcelVerticalAlignment.Center;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment