PdfRpt.Core.PdfTable.GroupsManager.ModifyRowData C# (CSharp) Method

ModifyRowData() public method

Applies ShowGroupingPropertiesInAllRows if it's necessary.
public ModifyRowData ( IList rowData ) : void
rowData IList row's data
return void
        public void ModifyRowData(IList<CellData> rowData)
        {
            if (!SharedData.IsGroupingEnabled) return;
            if (SharedData.PageSetup.GroupsPreferences == null) return;
            if (SharedData.PageSetup.GroupsPreferences.GroupType != GroupType.IncludeGroupingColumns) return;
            if (SharedData.PageSetup.GroupsPreferences.ShowGroupingPropertiesInAllRows) return;
            if (CurrentRowInfoData.LastGroupRowNumber == 1) return;

            var groupByProperties = SharedData.PdfColumnsAttributes.Where(x => x.IncludeInGrouping).ToList();

            foreach (var cell in rowData)
            {
                var groupingProperties = groupByProperties.Where(x => x.PropertyName == cell.PropertyName).ToList();
                foreach (var property in groupingProperties)
                {
                    if (property.PropertyIndex >= 0)
                    {
                        if (property.PropertyIndex == cell.PropertyIndex && property.PropertyName == cell.PropertyName)
                        {
                            cell.PropertyValue = string.Empty;
                            cell.FormattedValue = string.Empty;
                        }
                    }
                    else if (property.PropertyName == cell.PropertyName)
                    {
                        cell.PropertyValue = string.Empty;
                        cell.FormattedValue = string.Empty;
                    }
                }
            }
        }

Usage Example

示例#1
0
        private void addTableRow(IList <CellData> rowData, BaseColor backgroundColor, BaseColor foreColor)
        {
            var finalRowDataList = new List <CellData>();

            for (var columnNumber = 0; columnNumber < SharedData.ColumnsCount; columnNumber++)
            {
                var            col = SharedData.PdfColumnsAttributes[columnNumber];
                CellAttributes cell;
                if (col.IsRowNumber)
                {
                    cell = TableCellHelper.AddRowNumberCell(backgroundColor, foreColor, columnNumber);
                }
                else
                {
                    GroupsManager.ModifyRowData(rowData);
                    cell = TableCellHelper.AddRowCell(rowData, backgroundColor, foreColor, columnNumber);
                    updateAggregates(col, cell);
                }

                finalRowDataList.Add(new CellData
                {
                    PropertyName   = col.PropertyName,
                    PropertyValue  = cell.RowData.Value,
                    FormattedValue = cell.RowData.FormattedValue,
                    PropertyType   = cell.RowData.PropertyType
                });
            }

            _exporterManager.ApplyExporter(finalRowDataList, CurrentRowInfoData);
            CurrentRowInfoData.IsNewGroupStarted    = false;
            CurrentRowInfoData.PreviousTableRowData = rowData;
        }