Ejemplo n.º 1
0
        public static void AddTableColumnCell <T>(IEnumerable <PropertyInfo> properties, TableFactory table, IList <T> listItems)
        {
            foreach (var row in listItems.Select(o => new { Properties = properties.Select(g => g), Value = o }).ToList())
            {
                table.AddRow();
                foreach (PropertyInfo cell in row.Properties)
                {
                    var cellValue     = row.Properties.Select(g => cell.GetValue(row.Value, null)).FirstOrDefault();
                    var styleProperty = ((ExportableColumnContentStyleAttribute)cell.GetCustomAttributes(typeof(ExportableColumnContentStyleAttribute), false).FirstOrDefault());
                    var addtionalText = ((ExportableAddtionalTextAttribute)cell.GetCustomAttributes(typeof(ExportableAddtionalTextAttribute), false).FirstOrDefault());

                    table.AddColumnContentText(cellValue, styleProperty != null ? styleProperty.Styles : new string[] { }, addtionalText);
                }
                table.EndRow();
            }
        }