PdfRpt.Core.PdfTable.RowsManager.CloseMainTable C# (CSharp) Method

CloseMainTable() public method

Finalizing the MainTable's rendering
public CloseMainTable ( ) : void
return void
        public void CloseMainTable()
        {
            if (_dataSourceIsEmpty)
            {
                if (SharedData.MainTableEvents != null)
                    SharedData.MainTableEvents.MainTableAdded(new EventsArguments { PdfDoc = SharedData.PdfDoc, PdfWriter = SharedData.PdfWriter, Table = MainTable, ColumnCellsSummaryData = SharedData.ColumnCellsSummaryData, PreviousTableRowData = _previousTableRowData, PageSetup = SharedData.PageSetup, PdfFont = SharedData.PdfFont, PdfColumnsAttributes = SharedData.PdfColumnsAttributes });
                return;
            }

            MainTable.ElementComplete = true; //print the last footer
            if (SharedData.ShouldWrapTablesInColumns)
            {
                MainGroupTable.AddCell(new PdfPCell(MainTable) { Border = 0 });
                MainGroupTable.AddCell(new PdfPCell(TableHelper.CreateEmptyRowTable(fixedHeight: 30)) { Border = 0 });

                GroupsManager.AddAllGroupsSummary();

                new TablesInColumns
                {
                    PdfDoc = SharedData.PdfDoc,
                    PdfWriter = SharedData.PdfWriter,
                    PageSetup = SharedData.PageSetup,
                    CurrentRowInfoData = CurrentRowInfoData
                }.Wrap(MainGroupTable);
            }
            else
            {
                MainTable.SpacingAfter += MainTable.HeaderHeight + 2.5f;
                tryFitToContent();
                SharedData.PdfDoc.Add(MainTable);

                var lastRow = SharedData.ColumnCellsSummaryData.OrderByDescending(x => x.OverallRowNumber).FirstOrDefault();
                if (lastRow != null)
                    CurrentRowInfoData.LastRenderedRowNumber = lastRow.OverallRowNumber;

                GroupsManager.AddAllGroupsSummary();
            }

            if (MainTable.Rows.Any()) MainTable.DeleteBodyRows();
            mainTableAdded();
        }

Usage Example

コード例 #1
0
        // Public Methods (1)

        /// <summary>
        /// Starts rendering of the MainTable
        /// </summary>
        public void AddToDocument()
        {
            initData();
            _rowsManager.AddMainTableRows();
            _rowsManager.CloseMainTable();
        }