public ExcelColumnInfo Build <TProperty>(Expression <Func <TModel, TProperty> > propertyExpr,
                                                 string title,
                                                 string format,
                                                 int width)
        {
            var column = new ExcelColumnInfo();

            column.Property = GetPropertyInfo(propertyExpr);
            column.Title    = title;
            column.Format   = format;
            column.Width    = width;

            return(column);
        }
Example #2
0
        private static ExcelColumnInfo LookUpColumn(IList <ExcelColumnInfo> columnList, ExcelColumnOverrideInfo columnOverride)
        {
            ExcelColumnInfo existColumn = null;

            if (columnOverride.Index.HasValue && columnOverride.Index.Value < columnList.Count)
            {
                existColumn = columnList[columnOverride.Index.Value];
            }
            if (existColumn == null && !String.IsNullOrEmpty(columnOverride.Title))
            {
                existColumn = columnList.FirstOrDefault(c => c.Title == columnOverride.Title);
            }
            return(existColumn);
        }