public void ParseIndexTest() { string index = "AA13:BB13"; int[] result = { 26, 12, 53, 12 }; TableRect rect = parse.ParseRect(index); Assert.AreEqual(rect.x, result[0]); Assert.AreEqual(rect.y, result[1]); Assert.AreEqual(rect.width, result[2] - result[0] + 1); Assert.AreEqual(rect.heigh, result[3] - result[1] + 1); }
public bool TryConverValue(TableRect rect, ITable value, out TTargetType convertedValue) { TableRect relrect = value.Rect.GetRelativeCoordinateRect(rect).GetRelativeCoordinateRect(Rect); string key = value.GetCellData(relrect); TableRect tableRect = parseAddress.ParseRect(key); string tablename = parseAddress.GetTableName(key); string sheetname = parseAddress.GetSheetName(key); tablename = String.IsNullOrEmpty(tablename) ? value.TableName : tablename; sheetname = String.IsNullOrEmpty(sheetname) ? value.SheetName : sheetname; ITable table = tableContext.GetTable(tablename, sheetname); if (tableRect.Area == 0) { tableRect = table.Rect; } if (!ConverterMapping.TryConvert(tableRect, table, out convertedValue)) { return(false); } return(true); }
public bool TryMapValue(TEntity entity, ITable value, TableRect rect) { TableRect relrect = value.Rect.GetRelativeCoordinateRect(rect).GetRelativeCoordinateRect(Rect); string key = value.GetCellData(relrect); TableRect tableRect = parseAddress.ParseRect(key); string tablename = parseAddress.GetTableName(key); string sheetname = parseAddress.GetSheetName(key); tablename = String.IsNullOrEmpty(tablename) ? value.TableName : tablename; sheetname = String.IsNullOrEmpty(sheetname) ? value.SheetName : sheetname; ITable table = tableContext.GetTable(tablename, sheetname); if (tableRect.Area == 0) { tableRect = table.Rect; } if (!propertyConverter.TryConvert(tableRect, table, out TProperty convertedValue)) { return(false); } propertySetter(entity, convertedValue); return(true); }