public IList<ColumnAttributes> CreatePdfColumnDefinitions()
{
var result = new List<ColumnAttributes>();
if (_bodyDataSource == null || !_bodyDataSource.Rows().Any())
{
result.Add(getRowNoCol());
return result;
}
tryShowRowNumberColumn(result);
var firstRowCells = _bodyDataSource.Rows().FirstOrDefault();
if (firstRowCells == null)
{
result.Add(getRowNoCol());
return result;
}
var order = 2;
foreach (var cellData in firstRowCells)
{
Type type = null;
if (cellData.PropertyValue != null)
type = cellData.PropertyValue.GetType();
if (type != null && type.BaseType == typeof(MulticastDelegate))
continue;
var itemsTemplate = getColumnItemsTemplate(cellData.PropertyName, type);
if (itemsTemplate.BasicProperties == null)
itemsTemplate.BasicProperties = new CellBasicProperties();
setDisplayFormatFormula(cellData.PropertyName, type, itemsTemplate);
var colDef = new ColumnAttributes
{
HeaderCell = new HeadingCell
{
Caption = cellData.PropertyName
},
ColumnItemsTemplate = itemsTemplate,
Width = 1,
PropertyName = cellData.PropertyName,
IsVisible = true,
Order = order++,
CellsHorizontalAlignment = HorizontalAlignment.Center
};
setAggregateFunc(cellData.PropertyName, colDef, type);
result.Add(colDef);
}
if (!result.Any())
{
result.Add(getRowNoCol());
}
return result;
}