diff --git a/ExcelTool/ExcelHelper.cs b/ExcelTool/ExcelHelper.cs index 224ae67..f7a6bf9 100644 --- a/ExcelTool/ExcelHelper.cs +++ b/ExcelTool/ExcelHelper.cs @@ -83,6 +83,10 @@ namespace ExcelTool IRow row = sheet.GetRow(i); if (row == null) continue; + + // ID为空则跳过该行 + if (string.IsNullOrEmpty(GetCellValue(row.GetCell(0)))) continue; + TableExcelRow tableExcelRow = new(); for (int j = 0; j < headers.Count; j++) tableExcelRow.Add(GetCellValue(row.GetCell(j))); diff --git a/ExcelTool/Parser/GenAudioConsts.cs b/ExcelTool/Parser/GenAudioConsts.cs index 0bdb5ee..9e74dde 100644 --- a/ExcelTool/Parser/GenAudioConsts.cs +++ b/ExcelTool/Parser/GenAudioConsts.cs @@ -119,7 +119,9 @@ namespace ExcelTool.Parser if (idIndex < 0 || namesIndex < 0) continue; if (string.IsNullOrEmpty(row.StrList[idIndex])) continue; - uint id = Convert.ToUInt32(row.StrList[idIndex]); + uint id = Convert.ToUInt32(row.StrList[idIndex]); + if (id == 0) continue; // 跳过ID=0的行 + string rawNames = row.StrList[namesIndex]; List names = new(rawNames.Split(['|'], StringSplitOptions.RemoveEmptyEntries)); @@ -223,7 +225,9 @@ namespace ExcelTool.Parser if (idIndex < 0 || namesIndex < 0) continue; if (string.IsNullOrEmpty(row.StrList[idIndex])) continue; - uint id = Convert.ToUInt32(row.StrList[idIndex]); + uint id = Convert.ToUInt32(row.StrList[idIndex]); + if (id == 0) continue; // 跳过ID=0的行 + string rawNames = row.StrList[namesIndex]; List names = new(rawNames.Split(['|'], StringSplitOptions.RemoveEmptyEntries)); diff --git a/ExcelTool/Parser/GenModels.cs b/ExcelTool/Parser/GenModels.cs index 4df0e23..8fa545c 100644 --- a/ExcelTool/Parser/GenModels.cs +++ b/ExcelTool/Parser/GenModels.cs @@ -201,8 +201,9 @@ namespace ExcelTool.Parser if (idIndex < 0 || namesIndex < 0) continue; if (string.IsNullOrEmpty(row.StrList[idIndex])) continue; - + uint id = Convert.ToUInt32(row.StrList[idIndex]); + if (id == 0) continue; // 跳过ID=0的行 // Names 是用分隔符(例如 '|')拼接的字符串 string rawNames = row.StrList[namesIndex];