模板样式 空行取/

This commit is contained in:
路 范
2022-03-14 02:29:03 +08:00
parent 93314bf6ef
commit fd46d710fe
4 changed files with 17 additions and 11 deletions

View File

@@ -84,8 +84,7 @@ namespace TempTask.WebEntry.Tools
int current_skip_count = 0;
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;
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();
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 (string.IsNullOrWhiteSpace(column_letter))
continue;
var jtoken = datas[i - current_skip_count][column_letter];
var cellvalue = string.Empty;
if (jtoken.Type == JTokenType.Null)
cellvalue = "/";
if (i >= datas.Count + (sheet_item.skip_rows?.Count ?? 0))
{
sheet.GetRow(c_rowindex).GetCell(x).SetCellValue("/");
}
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;
//foreach (var cell in cells)