private void SetTotalValue() { int lastRow = this.PrintingTable.GetRows() - 1; int lastCol = this.PrintingTable.GetColumns() - 1; this.TotalRows.Add(lastRow); // this.PrintingTable.MergeCells(lastRow,lastRow,0,lastCol); // // WebbTableCell cell = this.PrintingTable.GetCell(lastRow,0) as WebbTableCell; // // if(cell != null) // { // cell.Text = string.Format("{0}: {1}",this._TotalTitle,this.FilteredRows.Count); // } //05-09-2008@Scott int index = 0; bool bFindFirstCol = false; for (int col = 0; col <= lastCol; col++) { if (index > this.TotalSummaries.Count - 1) { break; } if (this.ColumnStyleRows.GroupColumns.Contains(col) || col == 0) { continue; } if (!this.TotalColumns.Contains(col)) { index++; continue; } if (!bFindFirstCol) { int startCol = col > 1 ? col - 2 : col - 1; this.PrintingTable.MergeCells(lastRow, lastRow, startCol, col - 1); this.PrintingTable.GetCell(lastRow, startCol).Text = this.TotalTitle; bFindFirstCol = true; } WebbTableCell cell = this.PrintingTable.GetCell(lastRow, col) as WebbTableCell; GroupSummary summary = this.TotalSummaries[index++]; WebbTableCellHelper.SetCellValue(this.PrintingTable, lastRow, col, summary); } }
private void SetRowsValue(ref int i_Row, ref int i_Col, GroupInfo i_GroupInfo) { int m_OriginalStartCol = i_Col; int m_Rows = i_GroupInfo.GetGroupedRows(); if (i_GroupInfo.GroupResults != null) { //if not section group , sort group result if (!(i_GroupInfo is SectionGroupInfo)) { i_GroupInfo.GroupResults.Sort(i_GroupInfo.Sorting, i_GroupInfo.SortingBy); } } for (int m_row = 0; m_row < m_Rows; m_row++) { GroupResult m_GroupResult = i_GroupInfo.GroupResults[m_row]; #region set summaryies if (i_GroupInfo.FollowSummaries) { if (m_GroupResult.Summaries != null) { foreach (GroupSummary m_Summary in m_GroupResult.Summaries) { //if group have click event , summaries also need. if (m_GroupResult.ClickEvent == ClickEvents.PlayVideo) { WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, i_Row, i_Col, m_Summary); //03-10-2008@Scott } else { WebbTableCellHelper.SetCellValue(this.PrintingTable, i_Row, i_Col, m_Summary); } i_Col++; } } } #endregion //Set grouped value #region set grouped value if (m_GroupResult.ClickEvent == ClickEvents.PlayVideo) { WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, i_Row, i_Col, m_GroupResult.GroupValue, FormatTypes.String, m_GroupResult.RowIndicators); } else { WebbTableCellHelper.SetCellValue(this.PrintingTable, i_Row, i_Col, m_GroupResult.GroupValue, FormatTypes.String); } this.ColumnStyleRows.GroupColumns.Add(i_Col); #endregion //Merge cells for section row #region Merge cell for section row if (i_GroupInfo.DistinctValues) { this.PrintingTable.MergeCells(i_Row, i_Row, i_Col, this.PrintingTable.GetColumns() - 1); this.SectionRows.Add(i_Row); i_Row++; } #endregion //useless #region set header for one value per page if (i_GroupInfo == this._RootGroupInfo && this.OneValuePerPage && this.HaveHeader) { //add break row indicators for page break this.BreakRows.Add(i_Row); int nHeaderStart = i_Row, nHeaderCount = 0; this.SetHeaderValue(ref i_Row); nHeaderCount = i_Row - nHeaderStart; this.SetHeaderRows(nHeaderStart, nHeaderCount); } #endregion #region set summaryies if (i_GroupInfo.FollowSummaries) { } else { if (m_GroupResult.Summaries != null) { foreach (GroupSummary m_Summary in m_GroupResult.Summaries) { i_Col++; //if group have click event , summaries also need. if (m_GroupResult.ClickEvent == ClickEvents.PlayVideo) { WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, i_Row, i_Col, m_Summary); //03-10-2008@Scott } else { WebbTableCellHelper.SetCellValue(this.PrintingTable, i_Row, i_Col, m_Summary); } } } } #endregion #region Set sub rows if (m_GroupResult.SubGroupInfos.Count > 0) { int m_StartRow = i_Row; int maxRow = 0; bool bFirstIn = true; //06-23-2008@Scott foreach (GroupInfo groupInfo in m_GroupResult.SubGroupInfos) { if (!i_GroupInfo.DistinctValues || !bFirstIn) //06-23-2008@Scott { if (bFirstIn) { bFirstIn = false; //06-23-2008@Scott } i_Col++; } this.SetRowsValue(ref i_Row, ref i_Col, groupInfo); maxRow = Math.Max(maxRow, i_Row); i_Row = m_StartRow; } if (maxRow > m_StartRow) { maxRow--; } else if (i_GroupInfo.DistinctValues) { maxRow--; } i_Row = maxRow; } if (this.AcrossPage) { i_Col++; //06-27-2008@Scott } else { i_Row++; if (m_row < m_Rows - 1) { i_Col = m_OriginalStartCol; } } #endregion } #region Set total row // if(i_GroupInfo.AddTotal&&i_GroupInfo.TotalSummaries!=null) // { // i_Col = m_OriginalStartCol; // // if(i_GroupInfo.FollowSummaries) // { // i_Col--; // } // else // { // SetCellValue(i_Row,i_Col,i_GroupInfo.TotalTitle,FormatTypes.String); // } // // Int32Collection totalIndicators = (i_GroupInfo as FieldGroupInfo).GetTotalIndicators(i_GroupInfo); // // foreach(GroupSummary m_TotalSummary in i_GroupInfo.TotalSummaries) // { // i_Col++; // // //04-24-2008@Scott // while(this.ColumnStyleRows.GroupColumns.Contains(i_Col)) // { // i_Col++; // } // // //05-08-2008@Scott // switch(m_TotalSummary.SummaryType) // { // case SummaryTypes.RelatedPercent: // case SummaryTypes.GroupPercent: // if(m_TotalSummary.Filter.Count == 0) continue; // break; // case SummaryTypes.FreqAndPercent: // case SummaryTypes.FreqAndRelatedPercent: // continue; // default: // break; // } // // if(i_GroupInfo.ClickEvent == ClickEvents.PlayVideo) // { // // WebbTableCellHelper.SetCellValueWithClickEvent(i_Row,i_Col,m_TotalSummary); // } // else // { // WebbTableCellHelper.SetCellValue(i_Row,i_Col,m_TotalSummary); // } // } // // this.TotalRows.Add(i_Row); // // i_Row++; // } #endregion }
protected void SetValues() { int row = 0, col = 0, index = 0; foreach (StatInfo info in this._StatInfos) { WebbTableCell cell = this.PrintingTable.GetCell(row, col) as WebbTableCell; string title = info.Title; if (title.IndexOf(@"\[") >= 0 & title.IndexOf(@"\]") >= 0) { title.Replace(@"\[", "["); title.Replace(@"\]", "["); } else { title = title.Replace("[onevalue]", this.OneValueScFilter.FilterName); //06-04-2008@Scott title = title.Replace("[ONEVALUE]", this.OneValueScFilter.FilterName); //06-04-2008@Scott title = title.Replace("[repeat]", this.RepeatFilter.FilterName); //06-04-2008@Scott title = title.Replace("[REPEAT]", this.RepeatFilter.FilterName); //06-04-2008@Scott } //set title if (info.ClickEvent != ClickEvents.PlayVideo) { WebbTableCellHelper.SetCellValue(this.PrintingTable, row, col, title, FormatTypes.String); } else { WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, row, col, title, FormatTypes.String, info.RowIndicators); } col++; index = 0; //set stat results foreach (FollowedStatTypes followtype in info.StatisticalSetting) { if (index < info.Result.Count) { cell = this.PrintingTable.GetCell(row, col) as WebbTableCell; object value = info.Result[index]; if (info.ClickEvent != ClickEvents.PlayVideo) { WebbTableCellHelper.SetCellValue(this.PrintingTable, row, col, value, followtype); } else { WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, row, col, value, followtype, info.RowIndicators); } cell.Text += followtype.Followed; } col++; index++; } if (this._Multiline) { col = 0; row++; } } }
private void SetHeaderValue(ref int nRow) { int nCol = 0; if (this.TableHeaders != null && this.TableHeaders.RowCount > 0 && this.TableHeaders.ColCount > 0) //2008-8-29 9:12:52@simon { this.TableHeaders.SetHeaders(PrintingTable, ref nRow, this); } int totalRows = this.PrintingTable.GetRows(); int totalCols = this.PrintingTable.GetColumns(); if (this._ShowRowIndicators) { nCol++; } if (this.HaveHeader) //Modified at 2008-10-21 8:49:30@Simon { if (RootGroupInfo.ColorNeedChange) { this.PrintingTable.SetRowStyle(nRow, RootGroupInfo.Style); } if (RootGroupInfo.SubGroupInfos.Count > 0) { if (RootGroupInfo.SubGroupInfos[0].ColorNeedChange) { this.PrintingTable.SetRowStyle(nRow + 1, RootGroupInfo.SubGroupInfos[0].Style); } } #region Have Header int mergedspan = this.GetMergedSpan(); for (int i = 0; i < this.RootGroupInfo.GroupResults.Count; i++) { GroupResult m_Result = RootGroupInfo.GroupResults[i]; if (RootGroupInfo.ClickEvent == ClickEvents.PlayVideo) { WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, nRow, nCol, m_Result.GroupValue, FormatTypes.String, m_Result.RowIndicators); } else { WebbTableCellHelper.SetCellValue(this.PrintingTable, nRow, nCol, m_Result.GroupValue, FormatTypes.String); } this.PrintingTable.MergeCells(nRow, nRow, nCol, nCol + mergedspan - 1); IWebbTableCell cell = this.PrintingTable.GetCell(nRow, nCol); if (nRow < totalRows - 1 && cell != null) { cell.CellStyle.Sides &= ~DevExpress.XtraPrinting.BorderSide.Bottom; } #region Sub GroupInfo if (this.RootGroupInfo.SubGroupInfos.Count > 0) { GroupInfo subGroupInfo = RootGroupInfo.GroupResults[i].SubGroupInfos[0]; for (int j = 0; j < subGroupInfo.GroupResults.Count; j++, nCol++) { GroupResult m_subResult = subGroupInfo.GroupResults[j]; if (subGroupInfo.ClickEvent == ClickEvents.PlayVideo) { WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, nRow + 1, nCol, m_subResult.GroupValue, FormatTypes.String, m_subResult.RowIndicators); } else { WebbTableCellHelper.SetCellValue(this.PrintingTable, nRow + 1, nCol, m_subResult.GroupValue, FormatTypes.String); } cell = this.PrintingTable.GetCell(nRow + 1, nCol); cell.CellStyle.Sides = DevExpress.XtraPrinting.BorderSide.None; if (cell != null) { cell.CellStyle.Sides |= DevExpress.XtraPrinting.BorderSide.Bottom; if (j == 0) { cell.CellStyle.Sides |= DevExpress.XtraPrinting.BorderSide.Left; } if (j == subGroupInfo.GroupResults.Count - 1) { cell.CellStyle.Sides |= DevExpress.XtraPrinting.BorderSide.Right; } } } } else { nCol++; } #endregion } nRow++; if (this.RootGroupInfo.SubGroupInfos.Count > 0) { nRow++; } #endregion } }
private void SetTableValue() { int m_Rows = 0, m_Col = 0; if (this.ShowRowIndicators) { m_Col = 1; //add row indicator columns } int nHeaderStart = m_Rows, nHeaderCount = 0; this.SetHeaderValue(ref m_Rows); //set header value nHeaderCount = m_Rows - nHeaderStart; this.SetHeaderRows(nHeaderStart, nHeaderCount); #region Set style int setRow = m_Rows; if (this.RootGroupInfo.Summaries.Count > 0) { this.PrintingTable.SetRowStyle(setRow, this.RootGroupInfo.Summaries[0].Style, this.ShowRowIndicators); setRow++; } if (RootGroupInfo.SubGroupInfos.Count > 0) { GroupInfo subGroupInfo = RootGroupInfo.SubGroupInfos[0]; foreach (GroupSummary m_Summary in subGroupInfo.Summaries) { this.PrintingTable.SetRowStyle(setRow, m_Summary.Style, this.ShowRowIndicators); setRow++; } } #endregion #region Set Rows Value int mergedspan = this.GetMergedSpan(); for (int i = 0; i < this.RootGroupInfo.GroupResults.Count; i++) { int tempRow = m_Rows; GroupResult m_Result = RootGroupInfo.GroupResults[i]; IWebbTableCell cell = null; if (m_Result.Summaries.Count > 0) { GroupSummary m_Summary = m_Result.Summaries[0]; if (RootGroupInfo.ClickEvent == ClickEvents.PlayVideo) { WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, tempRow, m_Col, m_Summary); } else { WebbTableCellHelper.SetCellValue(this.PrintingTable, tempRow, m_Col, m_Summary); } this.PrintingTable.MergeCells(tempRow, tempRow, m_Col, m_Col + mergedspan - 1); cell = this.PrintingTable.GetCell(tempRow, m_Col); if (cell == null) { continue; } if (tempRow < this.PrintingTable.GetRows() - 1 && cell != null) { cell.CellStyle.Sides &= ~DevExpress.XtraPrinting.BorderSide.Bottom; } tempRow++; } #region Sub GroupInfo if (this.RootGroupInfo.SubGroupInfos.Count > 0) { GroupInfo subGroupInfo = RootGroupInfo.GroupResults[i].SubGroupInfos[0]; for (int j = 0; j < subGroupInfo.GroupResults.Count; j++, m_Col++) { GroupResult m_subResult = subGroupInfo.GroupResults[j]; int nextRow = tempRow; for (int k = 0; k < m_subResult.Summaries.Count; k++) { GroupSummary m_Summary = m_subResult.Summaries[k]; WebbTableCellHelper.SetCellValue(this.PrintingTable, nextRow, m_Col, m_Summary); cell = this.PrintingTable.GetCell(nextRow, m_Col); if (cell == null) { continue; } cell.CellStyle.Sides = DevExpress.XtraPrinting.BorderSide.None; if (cell != null) { if (nextRow == 0) { cell.CellStyle.Sides |= DevExpress.XtraPrinting.BorderSide.Top; } if (k == m_subResult.Summaries.Count - 1) { cell.CellStyle.Sides |= DevExpress.XtraPrinting.BorderSide.Bottom; } if (j == 0) { cell.CellStyle.Sides |= DevExpress.XtraPrinting.BorderSide.Left; } if (j == subGroupInfo.GroupResults.Count - 1) { cell.CellStyle.Sides |= DevExpress.XtraPrinting.BorderSide.Right; } } nextRow++; } } } else { m_Col++; } #endregion } #endregion if (this.ShowRowIndicators) { this.SetRowIndicators(this.PrintingTable.GetRows()); } }
private void SetRowsValue(ref int i_Row, ref int i_Col, GroupInfo i_GroupInfo) { int m_OriginalStartCol = i_Col; int m_OriginalStartRow = i_Row; int m_Rows = i_GroupInfo.GetGroupedRows(); if (i_GroupInfo.GroupResults != null) {//if not section group , sort group result if (!(i_GroupInfo is SectionGroupInfo)) { i_GroupInfo.GroupResults.Sort(i_GroupInfo.Sorting, i_GroupInfo.SortingBy, i_GroupInfo.UserDefinedOrders); } } bool visible = GroupInfo.IsVisible(i_GroupInfo); for (int m_row = 0; m_row < m_Rows; m_row++) { GroupResult m_GroupResult = i_GroupInfo.GroupResults[m_row]; if (i_GroupInfo == this.RootGroupInfo && i_GroupInfo.IsSectionOutSide) { //Set grouped value #region set grouped value StringBuilder sbGroup = new StringBuilder(); sbGroup.Append(m_GroupResult.GroupValue); foreach (GroupSummary summary in m_GroupResult.Summaries) { string summaryValue = WebbTableCellHelper.FormatValue(null, summary); sbGroup.Append(summaryValue); } if (m_GroupResult.ClickEvent == ClickEvents.PlayVideo) { WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, i_Row, i_Col, sbGroup.ToString(), FormatTypes.String, m_GroupResult.RowIndicators); } else { WebbTableCellHelper.SetCellValue(this.PrintingTable, i_Row, i_Col, sbGroup.ToString(), FormatTypes.String); } #endregion #region Merge cell for section row this.PrintingTable.MergeCells(i_Row, i_Row, i_Col, this.PrintingTable.GetColumns() - 1); this.SectionRows.Add(i_Row); i_Row++; #endregion #region Set sub rows if (m_GroupResult.SubGroupInfos.Count > 0) { int m_StartRow = i_Row; int maxRow = 0; foreach (GroupInfo groupInfo in m_GroupResult.SubGroupInfos) { this.SetRowsValue(ref i_Row, ref i_Col, groupInfo); maxRow = Math.Max(maxRow, i_Row); i_Row = m_StartRow; } i_Row = maxRow - 1; } i_Row++; if (m_row < m_Rows - 1) { i_Col = m_OriginalStartCol; } #endregion } else { #region set summaryies ----Summaries before group if (i_GroupInfo.FollowSummaries && m_GroupResult.Summaries != null) { foreach (GroupSummary m_Summary in m_GroupResult.Summaries) { //if group have click event , summaries also need. if (m_GroupResult.ClickEvent == ClickEvents.PlayVideo) { WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, i_Row, i_Col, m_Summary); //03-10-2008@Scott } else { WebbTableCellHelper.SetCellValue(this.PrintingTable, i_Row, i_Col, m_Summary); } i_Col++; } } #endregion //Set grouped value #region set grouped value if (visible) { #region New string groupValue = string.Empty; if (m_GroupResult.GroupValue != null) { groupValue = m_GroupResult.GroupValue.ToString(); if (i_GroupInfo is FieldGroupInfo) { string followWith = (i_GroupInfo as FieldGroupInfo).FollowsWith; if (followWith != string.Empty && followWith.IndexOf("[VALUE]") >= 0) { groupValue = followWith.Replace("[VALUE]", groupValue); } } } if (m_GroupResult.ClickEvent == ClickEvents.PlayVideo) { WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, i_Row, i_Col, groupValue, FormatTypes.String, m_GroupResult.RowIndicators); } else { WebbTableCellHelper.SetCellValue(this.PrintingTable, i_Row, i_Col, groupValue, FormatTypes.String); } #endregion i_Col++; } #endregion #region set summaryies ----Summaries after group if (!i_GroupInfo.FollowSummaries) { if (m_GroupResult.Summaries != null) { foreach (GroupSummary m_Summary in m_GroupResult.Summaries) { //if group have click event , summaries also need. if (m_GroupResult.ClickEvent == ClickEvents.PlayVideo) { WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, i_Row, i_Col, m_Summary); //03-10-2008@Scott } else { WebbTableCellHelper.SetCellValue(this.PrintingTable, i_Row, i_Col, m_Summary); } i_Col++; } } } #endregion #region Set sub rows if (m_GroupResult.SubGroupInfos.Count > 0) { int m_StartRow = i_Row; int maxRow = 0; foreach (GroupInfo groupInfo in m_GroupResult.SubGroupInfos) { this.SetRowsValue(ref i_Row, ref i_Col, groupInfo); maxRow = Math.Max(maxRow, i_Row); i_Row = m_StartRow; } i_Row = maxRow - 1; } i_Row++; if (m_row < m_Rows - 1) { i_Col = m_OriginalStartCol; } #endregion } } #region Set total row if (i_GroupInfo.AddTotal && i_GroupInfo.TotalSummaries != null) { i_Col = m_OriginalStartCol; if (i_GroupInfo.IsSectionOutSide) { #region RootGroup Info & In IsSectionRow StringBuilder sbSummaryValue = new StringBuilder(); sbSummaryValue.Append(i_GroupInfo.TotalTitle); for (int i = 0; i < i_GroupInfo.Summaries.Count; i++) { if (i >= i_GroupInfo.TotalSummaries.Count) { continue; } GroupSummary summary = i_GroupInfo.TotalSummaries[i]; string summaryValue = WebbTableCellHelper.FormatValue(null, summary); sbSummaryValue.Append(summaryValue); } if (i_GroupInfo.ClickEvent == ClickEvents.PlayVideo) { Int32Collection totalIndicators = (i_GroupInfo as FieldGroupInfo).GetTotalIndicators(i_GroupInfo); WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, i_Row, i_Col, sbSummaryValue.ToString(), FormatTypes.String, totalIndicators); } else { WebbTableCellHelper.SetCellValue(this.PrintingTable, i_Row, i_Col, sbSummaryValue.ToString(), FormatTypes.String); } #endregion this.PrintingTable.MergeCells(i_Row, i_Row, i_Col, this.PrintingTable.GetColumns() - 1); } else { #region Not IsSectionOutSide if (i_GroupInfo.FollowSummaries) { i_Col--; } else { WebbTableCellHelper.SetCellValue(this.PrintingTable, i_Row, i_Col, i_GroupInfo.TotalTitle, FormatTypes.String); } foreach (GroupSummary m_TotalSummary in i_GroupInfo.TotalSummaries) { i_Col++; while (this._GroupColumns.Contains(i_Col)) { i_Col++; } //05-08-2008@Scott switch (m_TotalSummary.SummaryType) { case SummaryTypes.RelatedPercent: case SummaryTypes.GroupPercent: if (m_TotalSummary.Filter.Count == 0) { continue; } break; case SummaryTypes.FreqAndPercent: case SummaryTypes.FreqAndRelatedPercent: continue; default: break; } if (i_GroupInfo.ClickEvent == ClickEvents.PlayVideo) { WebbTableCellHelper.SetCellValueWithClickEvent(this.PrintingTable, i_Row, i_Col, m_TotalSummary); } else { WebbTableCellHelper.SetCellValue(this.PrintingTable, i_Row, i_Col, m_TotalSummary); } } #endregion } this.TotalRows.Add(i_Row); i_Row++; } #endregion }