Commit 102ca9e4 by Licx

提取数据新建sheet异常修改

parent b6d905e6
...@@ -84,7 +84,6 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo ...@@ -84,7 +84,6 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
ExcelStyle style = new ExcelStyle(workbook); ExcelStyle style = new ExcelStyle(workbook);
var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.列头, CellFormat.默认); var cellStyle = style.SetBgkColorAndFormat(style.GetCellStyle(), StyleType.列头, CellFormat.默认);
var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("1.0.")).OrderByDescending(t => t.Key).First();
var newSheet = workbook.CreateSheet(module.ModuleName); var newSheet = workbook.CreateSheet(module.ModuleName);
newSheet.GetOrCreate(1).GetOrCreate(6).SetCellValue("护理组分割比例:"); newSheet.GetOrCreate(1).GetOrCreate(6).SetCellValue("护理组分割比例:");
newSheet.GetOrCreate(1).GetOrCreate(6).CellStyle = cellStyle; newSheet.GetOrCreate(1).GetOrCreate(6).CellStyle = cellStyle;
...@@ -115,9 +114,9 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo ...@@ -115,9 +114,9 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank()); var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank());
if (sheet == null) if (sheet == null)
{ {
var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("3.")).OrderByDescending(t => t.Key).First(); var item = pairs.Where(t => t.Key.ToString().NoBlank().StartsWith("3.")).OrderByDescending(t => t.Key).FirstOrDefault();
var copysheet = workbook.GetSheet(item.Key); var copysheet = workbook.GetSheet(item.Key ?? "");
if (copysheet == null) continue; if (copysheet == null) break;
var newSheet = copysheet.CopySheet(module.ModuleName, true); var newSheet = copysheet.CopySheet(module.ModuleName, true);
workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1); workbook.SetSheetOrder(newSheet.SheetName, workbook.NumberOfSheets - 1);
...@@ -148,7 +147,7 @@ public static void ClearSheetPartialData(ISheet sheet, PerSheetPoint point, Shee ...@@ -148,7 +147,7 @@ public static void ClearSheetPartialData(ISheet sheet, PerSheetPoint point, Shee
{ {
var cell = row.GetCell(j); var cell = row.GetCell(j);
if (cell == null) continue; if (cell == null) continue;
if (cell.CellType != CellType.Formula || sheetType == SheetType.Income) if (cell.CellType != CellType.Formula || sheetType == SheetType.Income)
{ {
cell.RemoveCellComment(); cell.RemoveCellComment();
......
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