Пример #1
0
 private void AddPdfTitle <T>(int columnCount, TableFactory table)
 {
     if (!string.IsNullOrEmpty(this.PdfTitle))
     {
         table.AddRow();
         table.AddReportTitle(this.PdfTitle, columnCount, ReportService.GetTitleStyles <T>());
         table.EndRow();
     }
 }
Пример #2
0
        public static void AddTableColumnHeader(IEnumerable <PropertyInfo> properties, TableFactory table)
        {
            table.AddRow();
            foreach (var headerCell in properties)
            {
                var headerText    = ((ExportableColumnHeaderNameAttribute)headerCell.GetCustomAttributes(typeof(ExportableColumnHeaderNameAttribute), false).FirstOrDefault()).Description;
                var styleProperty = ((ExportableColumnHeaderStyleAttribute)headerCell.GetCustomAttributes(typeof(ExportableColumnHeaderStyleAttribute), false).FirstOrDefault());

                table.AddColumnTextHeader(headerText, styleProperty != null ? styleProperty.Styles : new string[] { });
            }
            table.EndRow();
        }
Пример #3
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();
            }
        }
Пример #4
0
        public static void AddColumnGroup(IEnumerable <PropertyInfo> properties, TableFactory table)
        {
            var columnGroup = properties.Select(c => c.GetCustomAttributes(typeof(ExportableColumnGroupAttribute), false).FirstOrDefault()).ToList();

            if (columnGroup.FirstOrDefault(c => ((ExportableColumnGroupAttribute)c) != null) == null)
            {
                return;
            }

            table.AddRow();
            foreach (var prop in columnGroup.GroupBy(c => ((ExportableColumnGroupAttribute)c) == null ? null : ((ExportableColumnGroupAttribute)c).Description))
            {
                var style = properties.Select(c => c.GetCustomAttributes(typeof(ExportableColumnGroupAttribute), false)).SelectMany(c => c.Where(p => ((ExportableColumnGroupAttribute)p) != null && ((ExportableColumnGroupAttribute)p).Styles.Count() > 0)).Where(p => ((ExportableColumnGroupAttribute)p).Description == prop.Key);
                table.AddColumnGroup(prop.Key ?? "", prop.Count(), style.FirstOrDefault() != null ? ((ExportableColumnGroupAttribute)style.FirstOrDefault()).Styles : new string[] { });
            }
            table.EndRow();
        }