private void ParseTsv(string filePath) { _tableFile = TableFile.LoadFromFile(filePath, Encoding.GetEncoding("GBK")); _columnCount = _tableFile.GetColumnCount(); // 通过TableFile注册头信息 var commentRow = _tableFile.GetRow(1); foreach (var kv in _tableFile.Headers) { var header = kv.Value; ColName2Index[header.HeaderName] = header.ColumnIndex; Index2ColName[header.ColumnIndex] = header.HeaderName; ColName2Statement[header.HeaderName] = header.HeaderMeta; ColName2Comment[header.HeaderName] = commentRow[header.ColumnIndex]; } }
public string GetString(string columnName, int dataRow) { return(_tableFile.GetRow(dataRow + 1 + 1)[columnName]); // 1行开始,并且多了说明行,+2 }