private static void ReadLineFromSheet(WDBSheet sheetData, ISheet sheet) { logHandler?.Invoke(LogType.Info, string.Format(LogMessage.INFO_START_READ_LINE)); int firstRowNum = readerExcelStyle.RowStartIndex + readerExcelStyle.FieldRowCount; int lastRowNum = sheet.LastRowNum; int firstColNum = sheet.GetRow(readerExcelStyle.RowStartIndex).FirstCellNum; int lastColNum = sheet.GetRow(readerExcelStyle.RowStartIndex).LastCellNum; bool isStart = false; for (int r = firstRowNum; r < lastRowNum; ++r) { IRow row = sheet.GetRow(r); if (row == null) { logHandler?.Invoke(LogType.Info, string.Format(LogMessage.INFO_LINE_EMPTY, r)); continue; } string cellValue = GetCellStringValue(row.GetCell(firstColNum)); if (string.IsNullOrEmpty(cellValue)) { if (!isStart) { continue; } } else { if (!isStart && cellValue == readerExcelStyle.LineStartFlag) { isStart = true; } else if (isStart && cellValue == readerExcelStyle.LineEndFlag) { isStart = false; break; } } WDBLine line = sheetData.AddLine(r); for (int c = firstColNum + 1; c < lastColNum; c++) { WDBField field = sheetData.GetFieldAtCol(c); if (field == null) { continue; } ICell valueCell = row.GetCell(c); line.AddCell(c, GetCellStringValue(valueCell)); } logHandler?.Invoke(LogType.Info, string.Format(LogMessage.INFO_CREATE_LINE, line)); } logHandler?.Invoke(LogType.Info, LogMessage.INFO_END_READ_LINE); }