public ShouldStartNewGroup ( IList |
||
rowCellsData | IList |
Current row's data |
return | bool |
public bool ShouldStartNewGroup(IList<CellData> rowCellsData)
{
if (!SharedData.IsGroupingEnabled) return false;
if (CurrentRowInfoData.LastOverallDataRowNumber == 1)
{
updateLastRowValues(rowCellsData);
return true;
}
foreach (var property in SharedData.GroupByProperties)
{
var currentCellValue = getCurrentCellValue(rowCellsData, property);
object lastRowCellValue;
if (_currentRowValues.TryGetValue(property, out lastRowCellValue))
{
if (!areEqual(lastRowCellValue, currentCellValue, property))
{
_currentRowValues.Clear();
updateLastRowValues(rowCellsData);
return true;
}
}
else
{
_currentRowValues.Add(new KeyValuePair<string, object>(property, currentCellValue));
}
}
return false;
}
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 }); }