【修复】修复解析excel数据出错时,打印行号有误的bug

main
walon 2021-11-13 14:53:34 +08:00
parent a11380d142
commit 390a72747d
3 changed files with 13 additions and 5 deletions

View File

@ -32,7 +32,7 @@ Luban工具有两种部属方式。
Client与Server在同个进程内运行不需要单独部属Luban.Server。
将运行脚本中%LUBAN_CLIENT%变量由 Luban.Client/Luban.Client 改为 Luban.ClientServer/Luban.ClientServer同时删除 -h (--host ) 选项及其参数(如果指定了-h选项则不启动内嵌Luban.Server使用云生成
将运行脚本中%LUBAN_CLIENT%变量由 Luban.Client/Luban.Client 改为 Luban.ClientServer/Luban.ClientServer同时删除 -h (--host ) 选项及其参数。
Luban.ClientServer是Luban.Client的功能超集可以完全替代Luban.Client。

View File

@ -72,8 +72,6 @@
- --output_code_dir 参数为生成的代码文件存放的路径。 建议建议指向 unity的 Assets 目录下的某级子目录
- --output_data_dir 参数为生成的数据文件的存放路径。
注意,如果你直接使用 Csharp_unity_json中的gen_code_json.bat脚本并且使用Luban.ClientServer一定要记得 =====**删除 -h %LUBAN_SERVER_IP% 参数** =====。因为添加-h 参数情况下,会使用云生成而不是本地生成!!!
详细的命令文档请看 [luban_command_tools](./luban_command_tools.md)。
如果一切正常,会产生一系列日志,最终一行是 == succ == 。

View File

@ -68,10 +68,20 @@ namespace Luban.Job.Cfg.DataSources.Excel
}
var cells = ParseRawSheetContent(reader, orientRow, false);
var title = ParseTitle(cells, reader.MergeCells, orientRow);
cells.RemoveAll(c => c.Count == 0 || IsHeaderRow(c));
cells.RemoveAll(c => IsNotDataRow(c));
return new RawSheet() { Title = title, TableName = tableName, Cells = cells };
}
private static bool IsNotDataRow(List<Cell> row)
{
if (row.Count == 0)
{
return true;
}
var s = row[0].Value?.ToString()?.Trim();
return !string.IsNullOrEmpty(s) && s.StartsWith("##");
}
public static Title ParseTitle(List<List<Cell>> cells, CellRange[] mergeCells, bool orientRow)
{
var rootTitle = new Title()
@ -334,7 +344,6 @@ namespace Luban.Job.Cfg.DataSources.Excel
int rowIndex = 0;
do
{
++rowIndex; // 第1行是 meta 标题及数据行从第2行开始
var row = new List<Cell>();
for (int i = 0, n = reader.FieldCount; i < n; i++)
{
@ -345,6 +354,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
{
break;
}
++rowIndex;
} while (reader.Read());
List<List<Cell>> finalRows;