/// <summary> /// Finalizing the MainTable's rendering /// </summary> 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(); }