Commit b264cfe8 by lcx

Merge branch 'hotfix/提取工作簿修改'

parents eac2d6e9 5f554e53
......@@ -46,17 +46,21 @@ public static void WriteSheetHeader(ISheet sheet, PerSheetPoint point, SheetType
var category = columnHeader.GetCell(index).GetDecodeEscapes();
if (string.IsNullOrEmpty(category)) continue;
if (index > headerFirstCellNum) headerFirstCellNum = index;
var column = columns.FirstOrDefault(t => t.ColumnName.NoBlank() == category);
if (sheetType == SheetType.Income)
if (sheetType != SheetType.Income)
{
WriteFactor(doctorFactor, index, column?.DoctorFactor, factorStyle);
WriteFactor(nurseFactor, index, column?.NurseFactor, factorStyle);
WriteFactor(technicianFactor, index, column?.TechnicianFactor, factorStyle);
if (index > headerFirstCellNum) headerFirstCellNum = index;
columns.RemoveAll(t => t.ColumnName.NoBlank() == category);
}
else
{
var rows = new IRow[] { nurseFactor, doctorFactor, technicianFactor, columnHeader };
foreach (var item in rows)
{
var cell = item.GetCell(index);
if (cell != null)
item.RemoveCell(cell);
}
}
columns.RemoveAll(t => t.ColumnName.NoBlank() == category);
}
if (headerFirstCellNum > point.DataFirstCellNum.Value)
headerFirstCellNum += 1;
......@@ -171,17 +175,14 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var column = columnHeader.GetOrCreate(cellIndex).GetDecodeEscapes();
var cell = row.GetOrCreate(cellIndex);
if (string.IsNullOrEmpty(column)) continue;
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
//数据为空,且单元格值不为空,不写入数据(保留原始值)
var notWrite = !value.HasValue && !string.IsNullOrEmpty(cell.ToString());
if (/*cell.CellType != CellType.Formula && */!notWrite)
{
if (value.HasValue && value != 0)
cell.SetCellValue<decimal>(value);
if (headers != null && headers.Contains(column))
{
cell.CellStyle = cellStyle;
}
}
if (headers != null && headers.Contains(column))
cell.CellStyle = cellStyle;
}
#endregion
......@@ -189,7 +190,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
data.RemoveAll(t => t.Department == department);
}
if (point.DataFirstRowNum.Value < dataFirstRowNum) dataFirstRowNum += 1;
//if (point.DataFirstRowNum.Value < dataFirstRowNum) dataFirstRowNum += 1;
}
private static void WriteSheetDataNonexistent(ISheet sheet, IRow columnHeader, PerSheetPoint point, SheetType sheetType, ExcelStyle style,
......@@ -236,7 +237,8 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
else if (sheetType == SheetType.Income || (headers != null && headers.Contains(column)))
{
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
cell.SetCellValue<decimal>(value);
if (value.HasValue && value != 0)
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle;
}
}
......@@ -288,11 +290,14 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var cell = row.GetOrCreate(cellIndex);
var value = deptData.FirstOrDefault(t => t.Category.NoBlank() == column)?.Value;
if (cell.CellType != CellType.Formula)
{
//if (cell.CellType != CellType.Formula)
//{
// cell.SetCellValue<decimal>(value);
// cell.CellStyle = cellStyle;
//}
if (value.HasValue && value != 0)
cell.SetCellValue<decimal>(value);
cell.CellStyle = cellStyle;
}
cell.CellStyle = cellStyle;
}
dataFirstRowNum++;
......
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