private static void applyPropertyName(PropertyInfo property, ColumnAttributes columnAttributes, bool areColumnsAdHoc)
{
if (columnAttributes.HeaderCell == null)
columnAttributes.HeaderCell = new HeadingCell();
if (string.IsNullOrEmpty(columnAttributes.HeaderCell.Caption) || areColumnsAdHoc)
{
var caption = property.GetColumnPropertyNameAttribute();
if (!string.IsNullOrEmpty(caption))
columnAttributes.HeaderCell.Caption = caption;
}
if (string.IsNullOrEmpty(columnAttributes.HeaderCell.Caption))
columnAttributes.HeaderCell.Caption = property.Name;
}