This commit is contained in:
H3ZV9FTKT90KGE2\Administrator
2022-03-14 02:34:55 +08:00
4 changed files with 17 additions and 11 deletions

View File

@@ -84,8 +84,7 @@ namespace TempTask.WebEntry.Tools
int current_skip_count = 0; int current_skip_count = 0;
for (int i = 0; i < sheet_item.null_row_count; i++) for (int i = 0; i < sheet_item.null_row_count; i++)
{ {
if (i >= datas.Count + (sheet_item.skip_rows?.Count ?? 0))
break;
var c_rowindex = startRowIndex + i; var c_rowindex = startRowIndex + i;
if (sheet_item.skip_rows != null && sheet_item.skip_rows.Contains(c_rowindex + 1)) if (sheet_item.skip_rows != null && sheet_item.skip_rows.Contains(c_rowindex + 1))
{ {
@@ -95,16 +94,23 @@ namespace TempTask.WebEntry.Tools
int cell_start_index = sheet_item.start_cell.ToExcelColumnIndex(); int cell_start_index = sheet_item.start_cell.ToExcelColumnIndex();
for (int x = cell_start_index; x < cell_start_index + sheet_item.null_cell_count; x++) for (int x = cell_start_index; x < cell_start_index + sheet_item.null_cell_count; x++)
{ {
var column_letter = App.Configuration[$"column_name_match_{excelTypeInt}_{sheet_item.sheet_no}:{ x.ToExcelColumnName()}"]; if (i >= datas.Count + (sheet_item.skip_rows?.Count ?? 0))
if (string.IsNullOrWhiteSpace(column_letter)) {
continue; sheet.GetRow(c_rowindex).GetCell(x).SetCellValue("/");
var jtoken = datas[i - current_skip_count][column_letter]; }
var cellvalue = string.Empty;
if (jtoken.Type == JTokenType.Null)
cellvalue = "/";
else else
cellvalue = jtoken.ToString(); {
sheet.GetRow(c_rowindex).GetCell(x).SetCellValue(cellvalue); var column_letter = App.Configuration[$"column_name_match_{excelTypeInt}_{sheet_item.sheet_no}:{ x.ToExcelColumnName()}"];
if (string.IsNullOrWhiteSpace(column_letter))
continue;
var jtoken = datas[i - current_skip_count][column_letter];
var cellvalue = string.Empty;
if (jtoken.Type == JTokenType.Null)
cellvalue = "/";
else
cellvalue = jtoken.ToString();
sheet.GetRow(c_rowindex).GetCell(x).SetCellValue(cellvalue);
}
} }
//var x = 0; //var x = 0;
//foreach (var cell in cells) //foreach (var cell in cells)