public ReportBuilder AddTable(PdfTableModel table)
        {
            if (report.Tables == null)
            {
                report.Tables = new List <PdfTableModel>();
            }

            report.Tables.Add(table);

            return(this);
        }
        public ReportBuilder AddChart(
            IChartBuilder chartBuilder,
            string textAlign             = "center",
            int innerMargins             = 0,
            string innerMarginsDirection = null,
            int outerMargins             = 0,
            string outerMarginsDirection = null,
            bool newPageAfterChart       = false)
        {
            var pdfTableModel = new PdfTableModel()
            {
                NewPageAfterTable     = newPageAfterChart,
                OuterMargins          = outerMargins,
                OuterMarginsDirection = outerMarginsDirection,
                InnerMargins          = innerMargins,
                InnerMarginsDirection = innerMarginsDirection
            };

            var cell = chartBuilder.BuildTableCell();

            cell.TextAlign = textAlign;

            pdfTableModel.Body = new List <List <PdfReportCellModel> >
            {
                new List <PdfReportCellModel>
                {
                    cell
                }
            };

            if (report.Tables == null)
            {
                report.Tables = new List <PdfTableModel>();
            }

            report.Tables.Add(pdfTableModel);

            return(this);
        }
Esempio n. 3
0
        public static int ToMaxColumnCount(this PdfTableModel table)
        {
            var headerCount = 0;
            var footerCount = 0;
            var bodyCount   = 0;

            if (table.Header != null && table.Header.Count > 0)
            {
                headerCount = table.Header.Count();
            }

            if (table.Footer != null && table.Footer.Count > 0)
            {
                footerCount = table.Footer.Count();
            }

            if (table.Body != null && table.Body.Count > 0)
            {
                bodyCount = table.Body.Select(x => x.Count).Max();
            }

            return(new int[] { headerCount, footerCount, bodyCount }.Max());
        }
 public void Clear()
 {
     table = new PdfTableModel();
 }
 public TableBuilder()
 {
     table = new PdfTableModel();
 }