public StartNewGroup ( IEnumerable |
||
groupHeaderRowCellsData | IEnumerable |
New group's header row data |
shouldCheckOneGroupPerPage | bool | Do we need a new page again? |
return | void |
public void StartNewGroup(IEnumerable<CellData> groupHeaderRowCellsData, bool shouldCheckOneGroupPerPage)
{
MainTable.ElementComplete = true; //print the last footer
var hasRows = MainTable.Rows.Any();
if (hasRows)
{
if (SharedData.ShouldWrapTablesInColumns)
{
MainGroupTable.AddCell(new PdfPCell(MainTable) { Border = 0 });
}
else
{
MainTable.SpacingAfter += MainTable.HeaderHeight + 2.5f;
tryFitToContent();
SharedData.PdfDoc.Add(MainTable);
MainTable.DeleteBodyRows();
}
}
if (SharedData.MainTableEvents != null && _groupNumber > 0)
SharedData.MainTableEvents.GroupAdded(new EventsArguments { PdfDoc = SharedData.PdfDoc, PdfWriter = SharedData.PdfWriter, Table = MainGroupTable, ColumnCellsSummaryData = SharedData.ColumnCellsSummaryData, PreviousTableRowData = CurrentRowInfoData.PreviousTableRowData, PageSetup = SharedData.PageSetup, PdfFont = SharedData.PdfFont, PdfColumnsAttributes = SharedData.PdfColumnsAttributes });
_groupNumber++;
if (shouldCheckOneGroupPerPage) showOneGroupPerPage();
renderGroupHeader(groupHeaderRowCellsData);
initMainTable();
RowsManager.TableInitAddHeaderAndFooter();
reset();
}
private IList <BaseColor> applyRowSettings(IList <CellData> row) { if (_setNumberOfRowsPerPageNeedsNewPage) { SharedData.PdfDoc.NewPage(); } var backColor = CurrentRowInfoData.LastOverallDataRowNumber % 2 != 0 ? SharedData.Template.RowBackgroundColor : SharedData.Template.AlternatingRowBackgroundColor; var foreColor = CurrentRowInfoData.LastOverallDataRowNumber % 2 != 0 ? SharedData.Template.RowFontColor : SharedData.Template.AlternatingRowFontColor; CurrentRowInfoData.LastOverallDataRowNumber++; CurrentRowInfoData.LastGroupRowNumber++; if (GroupsManager.ShouldStartNewGroup(row)) { GroupsManager.StartNewGroup(row, !_setNumberOfRowsPerPageNeedsNewPage); } else { if (CurrentRowInfoData.LastOverallDataRowNumber == 1) { TableInitAddHeaderAndFooter(); } } return(new List <BaseColor> { backColor, foreColor }); }