private object GetPropertyValue(SheetModel model, string propertyName) { var value = model.GetPropertyValue(propertyName); if (value == null) { model.GetExtraProperties().TryGetValue(propertyName, out value); } return value; }
private Row BuildRowFromExpandoObject(SheetModel model, ISheetDefinition sheetDefinition) { var row = new Row(); foreach (var columnDefinition in sheetDefinition.ColumnDefinitions) { var propValue = GetPropertyValue(model, columnDefinition.PropertyName); CellValues cellType; string cellValue; _converterManager.GetCellTypeAndValue(propValue, out cellType, out cellValue); var cell = new Cell { DataType = cellType, CellValue = new CellValue(cellValue) }; cell.AddMdsolAttribute("type", propValue == null ? typeof(object).FullName : propValue.GetType().FullName); cell.AddMdsolAttribute("propertyName", columnDefinition.PropertyName); row.AppendChild(cell); } return row; }