private void SetUpRowGroupings() { this.RowGroupings.Clear(); RRowGrouping rowGrouping = new RRowGrouping(); { rowGrouping.Width = new Unit(0.25, UnitType.Inch); //DynamicRows { RDynamicRows dynamicRows = new RDynamicRows(); RGrouping rowGrouping1 = new RGrouping(this, this.RowGroupings); { RExpression groupingExpression1 = new RExpression(GetReportColumnValue(ReportDataColumns[7])); //new RExpression(String.Empty); rowGrouping1.GroupExpressions.Add(groupingExpression1); } dynamicRows.Grouping = rowGrouping1; dynamicRows.ReportItem = GetReportCellControlItem(ReportDataColumns[7] as ReportDataColumn); rowGrouping.DynamicRows = dynamicRows; } //StaticRows { //RStaticRows staticRows = new RStaticRows(); //RStaticRow staticRow1 = new RStaticRow(); //staticRow1.ReportItem = GetReportCellControlItem(ReportDataColumns[7] as ReportDataColumn); //staticRows.Add(staticRow1); //rowGrouping.StaticRows = staticRows; } } this.RowGroupings.Add(rowGrouping); }
private void SetUpCells() { Details.TableRows.Clear(); if ((reportTableGroups != null) && (reportTableGroups.Count > 0)) { #region apply grouping TableGroups = new RTableGroups(); for (int rtgIndex = 0; rtgIndex < reportTableGroups.Count; rtgIndex++) { ReportTableGroup reportTableGroup = reportTableGroups[rtgIndex]; //ReportColumn firstColumn = reportTableGroup.ColumnGrouping[0]; RTableGroup newGroup = new RTableGroup(); newGroup.Grouping.Name = string.Format("{0}_Group{1}", Name, rtgIndex + 1); //Grouping foreach (ReportColumn groupingColumn in reportTableGroup.ColumnGrouping) { RExpression groupingExpression = new RExpression(GetReportColumnValue(groupingColumn)); newGroup.Grouping.GroupExpressions.Add(groupingExpression); } //Sorting if (reportTableGroup.ColumnSorting.Count > 0) { RSorting groupSorting = new RSorting(); foreach (ReportColumn sortingColumn in reportTableGroup.ColumnSorting.Keys) { RSortBy sortByColumn = new RSortBy(); sortByColumn.SortExpression = GetReportColumnValue(sortingColumn); sortByColumn.Direction = reportTableGroup.ColumnSorting[sortingColumn]; groupSorting.SortBy.Add(sortByColumn); } newGroup.Sorting = groupSorting; } //Header { RHeader groupHeader = new RHeader(); { RTableRow headerRow = new RTableRow(); { BaseStyle hightlightStyleForRow = null; foreach (ReportColumn reportColumn in ReportDataColumns) { if (reportColumn is ReportDataColumn) { ReportControlItem tbxHeader; if (reportTableGroup.ColumnGrouping.Contains(reportColumn)) { tbxHeader = GetReportCellControlItem(reportColumn as ReportDataColumn); if (hightlightStyleForRow == null) { hightlightStyleForRow = tbxHeader.Item.Style; } } else { tbxHeader = new RTextBox(String.Empty); } RTableCell rTableCell = new RTableCell(); rTableCell.ReportItems.Add(tbxHeader); headerRow.TableCells.Add(rTableCell); } } if (hightlightStyleForRow != null) { hightlightStyleForRow.Border.Style = BorderStyle.None; headerRow.Style = hightlightStyleForRow; } } groupHeader.TableRows.Add(headerRow); } newGroup.Header = groupHeader; } //Footer { //RFooter groupFooter = new RFooter(); //newGroup.Footer = groupFooter; } TableGroups.Add(newGroup); } #endregion } RTableCell tCell; RTableRow tRow = new RTableRow(); tRow.Height = this.rowHeight; foreach (DataColumn dataColumn in SourceDataTable.Columns) { tCell = new RTableCell(); ReportControlItem rDataTableItem; int columnIndex = SourceDataTable.Columns.IndexOf(dataColumn); int reportItemZIndex = columnIndex + 1; ReportColumn reportColumn = reportDataColumns[columnIndex]; if (reportColumn is ReportDataColumn) { ReportDataColumn reportDataColumn = reportColumn as ReportDataColumn; if ((this.reportTableGroups != null) && (this.reportTableGroups.ContainsColumn(reportColumn))) { rDataTableItem = new RTextBox(string.Empty); } else { rDataTableItem = GetReportCellControlItem(reportDataColumn); } tCell.ReportItems.Add(rDataTableItem); tRow.TableCells.Add(tCell); } else if (reportColumn is ReportHyperlinkColumn) { } } Details.TableRows.Add(tRow); }