public override bool CreatePrintingTable() { int nCells = this.GetTableCells(); this.PrintingTable = new WebbTable(1, nCells); if (this._Bitmap != null) { this._Bitmap.Dispose(); } this._Bitmap = new Bitmap(this.ControlWidth, this.ControlHeight, this.ExControl.GetGraphics()); this._Graphics = Graphics.FromImage(this._Bitmap); this._Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; this.DrawImage(this._Graphics, new Rectangle(new Point(0, 0), new Size(this.ControlWidth, this.ControlHeight))); IWebbTableCell cell = this.PrintingTable.GetCell(0, 0) as WebbTableCell; cell.CellStyle.BorderColor = Color.Transparent; cell.CellStyle.Width = this._Bitmap.Width; cell.CellStyle.Height = this._Bitmap.Height; cell.Image = (Bitmap)this._Bitmap.Clone(); //Image.FromHbitmap(this._Bitmap.GetHbitmap()); return(true); }
private void SetCellStyle(IWebbTableCell cell) { cell.CellStyle.HorzAlignment = this.HorzAlignment; cell.CellStyle.HorzAlignment = HorzAlignment.Near; cell.CellStyle.VertAlignment = VertAlignment.Top; cell.CellStyle.Font = this._Font; cell.CellStyle.ForeColor = this.TextColor; cell.CellStyle.BackgroundColor = this.BackColor; cell.CellStyle.BorderWidth = 0; cell.CellStyle.BorderColor = Color.Transparent; cell.Text = this.GetVersionString(); SizeF m_Size = this.MeasureSize(cell); cell.CellStyle.Width = (int)m_Size.Width; cell.CellStyle.Height = (int)m_Size.Height; }
//set each cell's border private void ApplyStyle() { if (this.PrintingTable == null) { return; } for (int i = 0; i < this.PrintingTable.GetRows(); i++) { for (int j = 0; j < this.PrintingTable.GetColumns(); j++) { IWebbTableCell cell = this.PrintingTable.GetCell(i, j); cell.CellStyle.Sides = DevSides.None; if (i == 0) { cell.CellStyle.Sides |= DevSides.Top | DevSides.Bottom; } if (i == this.PrintingTable.GetRows() - 1) { cell.CellStyle.Sides |= DevSides.Bottom; } if (j == 0) { cell.CellStyle.Sides |= DevSides.Left; } if (j == this.PrintingTable.GetColumns() - 1) { cell.CellStyle.Sides |= DevSides.Right; } } } }
private void ApplyColumnWidthStyle(int m_Cols) { for (int i = this.ColumnsWidth.Count - 1; i >= 0; i--) { if (this.ColumnsWidth[i] == 0) { this.ColumnsWidth.RemoveAt(i); } } if (this.ColumnsWidth.Count <= 0) { return; } int count = Math.Min(this.ColumnsWidth.Count, m_Cols); int m_rows = this.PrintingTable.GetRows(); for (int m_col = 0; m_col < count; m_col++) { IWebbTableCell cell = this.PrintingTable.GetCell(0, m_col); cell.CellStyle.Width = ColumnsWidth[m_col]; } }
public void SetHeadGridLine(WebbTable table, Webb.Collections.Int32Collection HeaderRowsArray) { int rows = table.GetRows(); int cols = table.GetColumns(); if (this.GridLine || HeaderRowsArray.Count <= 0 || cols <= 0 || rows <= 0) { return; } int maxH = (int)HeaderRowsArray[0], minH = (int)HeaderRowsArray[0]; foreach (int hrow in HeaderRowsArray) //Get the Max rowindex and min rowindex of HeaderRows { maxH = Math.Max(maxH, hrow); minH = Math.Min(minH, hrow); } for (int i = minH; i <= maxH; i++) { if (i >= rows) { return; } for (int j = 0; j < cols; j++) { IWebbTableCell bordercell = table.GetCell(i, j); bordercell.CellStyle.Sides = DevExpress.XtraPrinting.BorderSide.None; if (i == minH) { bordercell.CellStyle.Sides |= DevExpress.XtraPrinting.BorderSide.Top; } if (j == 0) { bordercell.CellStyle.Sides |= DevExpress.XtraPrinting.BorderSide.Left; } if (j == cols - 1) { bordercell.CellStyle.Sides |= DevExpress.XtraPrinting.BorderSide.Right; } if (i == maxH) { bordercell.CellStyle.Sides |= DevExpress.XtraPrinting.BorderSide.Bottom; } if (i == minH && this.ColsToMerge.Contains(j)) { bordercell.CellStyle.Sides |= DevExpress.XtraPrinting.BorderSide.Bottom;; } if (j < this.ColCount && i < maxH) { HeaderCell hc = GetCell(i, j); if (j + hc.MergerdCount - 1 == cols - 1) { bordercell.CellStyle.Sides |= DevExpress.XtraPrinting.BorderSide.Right; } ; } } } }
public SizeF MeasureSize(IWebbTableCell i_Cell, Graphics m_Graph, int Width) { SizeF m_Size = m_Graph.MeasureString(i_Cell.Text, i_Cell.CellStyle.Font, Width); m_Size.Width += 4; m_Size.Height += 3; return(m_Size); }
public void SetCellValueAnsStyle(IWebbTable webbTable, int rowStart, ref int Col) { IWebbTableCell cell = webbTable.GetCell(rowStart, Col); if (this.ShowTitle) { cell.CellStyle.Sides = DevExpress.XtraPrinting.BorderSide.None; cell.CellStyle.ForeColor = this._TitleTextColor; cell.CellStyle.BackgroundColor = this._TitleBackColor; cell.CellStyle.HorzAlignment = this._TitleAlignment; cell.CellStyle.VertAlignment = this._VerticalAlignment; cell.CellStyle.Font = this._TitleFont; cell.Text = this.Title; Col++; cell = webbTable.GetCell(rowStart, Col); } if (this.ShowUnderLine) { cell.CellStyle.Sides = DevExpress.XtraPrinting.BorderSide.Bottom; cell.CellStyle.BorderStyle = DevExpress.XtraPrinting.BrickBorderStyle.Inset; } else { cell.CellStyle.Sides = DevExpress.XtraPrinting.BorderSide.None; } cell.CellStyle.ForeColor = this._MaskedTextColor; cell.CellStyle.BackgroundColor = this._MaskedBackColor; cell.CellStyle.HorzAlignment = this._MaskedAlignment; cell.CellStyle.VertAlignment = this._VerticalAlignment; cell.CellStyle.Font = this._MaskedFont; cell.Text = this._MaskedText; Col++; foreach (MaskInfo brotherInfo in this.BrotherMaskInfos) { brotherInfo.SetCellValueAnsStyle(webbTable, rowStart, ref Col); } }
public override bool CreatePrintingTable() { int CellCount = this._Chart.GetCellCount() + 1; //Added this code at 2008-11-11 8:36:08@Simon this.PrintingTable = new WebbTable(1, CellCount); if (this.ExControl.XtraContainer == null) { return(false); } Image bitmap = new Bitmap(this.ControlWidth, this.ControlHeight); Graphics g = Graphics.FromImage(bitmap); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; if (this._Chart != null) { this._Chart.Draw(g, new Rectangle(new Point(0, 0), new Size(this.ControlWidth, this.ControlHeight))); DataSet m_DBSet = this.ExControl.DataSource as DataSet; //Added this code at 2008-11-11 10:29:19@Simon this._Chart.SetClickArgs(this.PrintingTable, m_DBSet); //Added this code at 2008-11-11 10:29:15@Simon this._ClickAreas = this._Chart.ClickAreas.Clone() as ArrayList; //Added this code at 2008-11-11 10:38:40@Simon } IWebbTableCell cell = this.PrintingTable.GetCell(0, 0); #region Modify codes at 2009-1-13 13:57:17@Simon for (int i = 0; i < CellCount; i++) { cell = this.PrintingTable.GetCell(0, i); cell.CellStyle.BorderColor = Color.Transparent; cell.CellStyle.Sides = DevExpress.XtraPrinting.BorderSide.None; } #endregion //End Modify cell = this.PrintingTable.GetCell(0, 0); cell.CellStyle.Width = bitmap.Width; cell.CellStyle.Height = bitmap.Height; cell.Image = (Bitmap)bitmap.Clone(); //Image.FromHbitmap(this._Bitmap.GetHbitmap()); return(true); }
public override bool CreatePrintingTable() { if (this.PrintingTable == null) { this.PrintingTable = new WebbTable(1, 1); } IWebbTableCell m_Cell = this.PrintingTable.GetCell(0, 0); m_Cell.CellStyle.Width = (int)Rect.Width; m_Cell.CellStyle.Height = (int)Rect.Height; return(true); }
public override bool CreatePrintingTable() { if (this.PrintingTable == null) { this.PrintingTable = new WebbTable(1, 1); } IWebbTableCell m_Cell = this.PrintingTable.GetCell(0, 0); this.SetCellStyle(m_Cell); return(true); }
public void SetSize(int i_Width, int i_Height) { this._Width = i_Width; this._Height = i_Height; IWebbTableCell m_Cell = this.PrintingTable.GetCell(0, 0); SizeF m_Size = this.MeasureSize(m_Cell); m_Cell.CellStyle.Width = (int)m_Size.Width; m_Cell.CellStyle.Height = (int)m_Size.Height; }
public SizeF MeasureSize(IWebbTableCell i_Cell) { Graphics m_Graph = this.ExControl.CreateGraphics(); SizeF m_Size = SizeF.Empty; m_Size = m_Graph.MeasureString(i_Cell.Text, i_Cell.CellStyle.Font); m_Size.Width += 5; m_Size.Height += 5; return(m_Size); }
public SizeF MeasureSize(IWebbTableCell i_Cell) { Graphics m_Graph = this.ExControl.CreateGraphics(); SizeF m_Size = SizeF.Empty; m_Size = m_Graph.MeasureString(i_Cell.Text, i_Cell.CellStyle.Font); m_Size.Width += 2; //Modify this code at 2008-11-26 15:59:11@Simon m_Size.Height += 5; return(m_Size); }
private void ApplyRowHeightStyle(int m_Rows) { if (this.RowsHight.Count <= 0) { return; } int count = Math.Min(this.RowsHight.Count, m_Rows); for (int m_row = 0; m_row < count; m_row++) { IWebbTableCell cell = this.PrintingTable.GetCell(m_row, 0); cell.CellStyle.Height = this.RowsHight[m_row]; } }
protected override void InitLayout() { base.InitLayout(); if (this.MainView.PrintingTable != null) { IWebbTableCell cell = this.MainView.PrintingTable.GetCell(0, 0); if (cell == null) { return; } if (cell.Text != string.Empty) { this.AutoAdjustSize(); } } }
private void ApplyColumnWidthStyle(int m_Cols) { if (this.ColumnsWidth.Count <= 0) { return; } int count = Math.Min(this.ColumnsWidth.Count, m_Cols); for (int m_col = 0; m_col < count; m_col++) { IWebbTableCell cell = this.PrintingTable.GetCell(0, m_col); cell.CellStyle.Width = this.ColumnsWidth[m_col]; } }
private void ApplyColumnWidthStyle(int m_Cols) { if (this.ColumnsWidth.Count <= 0) { return; } int count = Math.Min(this.ColumnsWidth.Count, m_Cols); for (int m_col = 0; m_col < count; m_col++) { IWebbTableCell cell = this.PrintingTable.GetCell(0, m_col); if (this.MatrixInfo != null && this.MatrixInfo.RowTotal.ShowTotal && !this.MatrixInfo.RowTotal.ShowFront) { if (m_Cols < this.ColumnsWidth.Count) { if (m_col == count - 1) { cell.CellStyle.Width = ColumnsWidth[this.ColumnsWidth.Count - 1]; continue; } } else if (m_Cols > this.ColumnsWidth.Count) { if (m_col == count - 1) { continue; } } } cell.CellStyle.Width = ColumnsWidth[m_col]; } if (this.MatrixInfo != null && this.MatrixInfo.RowTotal.ShowTotal && !this.MatrixInfo.RowTotal.ShowFront) { IWebbTableCell cell = this.PrintingTable.GetCell(0, m_Cols - 1); if (m_Cols > this.ColumnsWidth.Count && cell != null) { cell.CellStyle.Width = ColumnsWidth[this.ColumnsWidth.Count - 1]; } } }
public int SetAutoWapSize() { this.CreatePrintingTable(); Graphics m_Graph = this.ExControl.CreateGraphics(); SizeF m_Size = SizeF.Empty; int OldControlHeight = this.ExControl.Height; IWebbTableCell i_Cell = this.PrintingTable.GetCell(0, 0); m_Size = m_Graph.MeasureString(i_Cell.Text, i_Cell.CellStyle.Font, this.ExControl.Width); this.ExControl.Height = Math.Max(OldControlHeight, (int)m_Size.Height + 2); return(this.ExControl.Height - OldControlHeight); }
private void SetCellStyle(IWebbTableCell cell) { cell.CellStyle.HorzAlignment = this.HorzAlignment; cell.CellStyle.VertAlignment = this.VertAlignment; cell.CellStyle.Font = this._Font; cell.CellStyle.ForeColor = this.TextColor; cell.CellStyle.BackgroundColor = this.BackColor; // cell.CellStyle.BorderWidth = 0; // // cell.CellStyle.BorderColor = Color.Transparent; cell.CellStyle.Sides = this.BorderSide; cell.CellStyle.BorderColor = this.BorderColor; cell.CellStyle.BorderWidth = this.BorderWidth; cell.CellStyle.BorderStyle = BrickBorderStyle.Inset; cell.Text = this.GetText(); //Add at 2009-2-24 10:18:00@Simon SizeF m_Size = this.ExControl.Bounds.Size; //this.MeasureSize(cell); if (this.ThreeD) { cell.CellStyle.Width = (int)m_Size.Width - 5; cell.CellStyle.Height = (int)m_Size.Height - 5; } else { cell.CellStyle.Width = (int)m_Size.Width; cell.CellStyle.Height = (int)m_Size.Height; } }
private void ApplyRowHeightStyle(int m_Rows) { if (this.RowsHight.Count <= 0) { return; } if (this.RowsHight.Count != m_Rows) { return; } for (int m_row = 0; m_row < m_Rows; m_row++) { IWebbTableCell cell = this.PrintingTable.GetCell(m_row, 0); int cellHeight = cell.CellStyle.Height; cell.CellStyle.Height = Math.Max(this.RowsHight[m_row], cellHeight); } }
public void SetSize(int i_Width, int i_Height) { // this._Width = i_Width; // // this._Height = i_Height; // IWebbTableCell m_Cell = this.PrintingTable.GetCell(0, 0); // // SizeF m_Size = this.MeasureSize(m_Cell); if (this.ThreeD) { m_Cell.CellStyle.Width = i_Width - 5; m_Cell.CellStyle.Height = i_Height - 5; } else { m_Cell.CellStyle.Width = i_Width; m_Cell.CellStyle.Height = i_Height; } }
public override bool CreatePrintingTable() { if (this._Image != null) { this.PrintingTable = new WebbTable(1, 1); IWebbTableCell cell = this.PrintingTable.GetCell(0, 0); cell.CellStyle.BorderColor = Color.Transparent; cell.Image = this.InverImage(this._Image); if (this._SizeMode == PictureBoxSizeMode.StretchImage) { cell.CellStyle.Width = (int)(this.ExControl.XtraContainer.Width / Webb.Utility.ConvertCoordinate); cell.CellStyle.Height = (int)(this.ExControl.XtraContainer.Height / Webb.Utility.ConvertCoordinate); } else if (this._SizeMode == PictureBoxSizeMode.CenterImage) {// 01-04-2012 Scott int nWidth = (int)(this.ExControl.XtraContainer.Width / Webb.Utility.ConvertCoordinate); int nHeight = (int)(this.ExControl.XtraContainer.Height / Webb.Utility.ConvertCoordinate); int nSuggestedWidth = (int)((float)nHeight * this._Image.Width / this._Image.Height); int nSuggestedHeight = (int)((float)nWidth * this._Image.Height / this._Image.Width); if (nWidth > nSuggestedWidth) { this._Offset = new Size((int)(((float)nWidth - nSuggestedWidth) / 2), 0); this.SetOffset(0, 0); nWidth = nSuggestedWidth; } else { this._Offset = new Size(0, (int)(((float)nHeight - nSuggestedHeight) / 2)); this.SetOffset(0, 0); nHeight = nSuggestedHeight; } cell.CellStyle.Width = nWidth; cell.CellStyle.Height = nHeight; } else { cell.CellStyle.Width = this._Image.Width; cell.CellStyle.Height = this._Image.Height; } if (this._SizeMode == PictureBoxSizeMode.CenterImage) {// 01-04-2012 Scott cell.ImageSizeMode = PictureBoxSizeMode.StretchImage; } else { cell.ImageSizeMode = (PictureBoxSizeMode)Enum.Parse(typeof(PictureBoxSizeMode), this._SizeMode.ToString(), false); } this.PrintingTable.ExControl = this.ExControl; } return(true); }
//public void SetHeaders(WebbTable table,ref int nRow) //{ // int cols=table.GetColumns(); // if(cols<=0)return; // for(int i=0;i<this.RowCount;i++) // { // for(int j=0;j<this._ColCount;j++) // { // if(i>=table.GetRows()||j>=cols)continue; // HeaderCell hc=GetCell(i,j); // IWebbTableCell tablecell=table.GetCell(i+nRow,j); // if(hc.MergerdCount>0) // { // int StartIndex=j; // int EndIndex=j+hc.MergerdCount-1; // if(EndIndex>=cols)EndIndex=cols-1; // if(EndIndex>StartIndex) // { // table.MergeCells(i,i,StartIndex,EndIndex); // } // if(hc.Text!="")tablecell.Text=hc.Text; // j=EndIndex; // } // else // { // if(hc.Text!="")tablecell.Text=hc.Text; // } // } // } // nRow+=this.RowCount; //} #endregion public void SetHeaders(WebbTable table, ref int nRow, Views.ExControlView i_View) { int totalColumnsInTable = table.GetColumns(); if (totalColumnsInTable <= 0) { return; } for (int i = 0; i < this.RowCount; i++) { for (int j = 0; j < this._ColCount; j++) { if (i >= table.GetRows() || j >= totalColumnsInTable) { continue; } HeaderCell hc = GetCell(i, j); IWebbTableCell tablecell = table.GetCell(i + nRow, j); if (hc == null || tablecell == null) { continue; } string strHeaderText = hc.Text; strHeaderText = strHeaderText.Replace("[onevalue]", i_View.OneValueScFilter.FilterName); strHeaderText = strHeaderText.Replace("[repeat]", i_View.RepeatFilter.FilterName); strHeaderText = strHeaderText.Replace("[ONEVALUE]", i_View.OneValueScFilter.FilterName); strHeaderText = strHeaderText.Replace("[REPEAT]", i_View.RepeatFilter.FilterName); if (hc.MergerdCount > 0) { int StartIndex = j; int EndIndex = j + hc.MergerdCount - 1; if (EndIndex >= totalColumnsInTable) { EndIndex = totalColumnsInTable - 1; } if (EndIndex > StartIndex) { table.MergeCells(i, i, StartIndex, EndIndex); } tablecell.Text = strHeaderText; j = EndIndex; } else { tablecell.MergeType = MergeTypes.None; tablecell.Text = strHeaderText; } } } nRow += this.RowCount; }
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 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 int GetMatrixMergedCount(WebbTable table) { if (MatrixInfo != null) { if (!MatrixInfo.ShowInOneCol) { if (MatrixInfo.CellTotal.ShowTotal) { return(2); } else { return(1); } } } int count = 1; //RowGroup Result int index = 0; if (this.ShowRowIndicators) { index = 1; } int MaxRows = table.GetRows(); if (index >= table.GetColumns() || table.HeaderCount >= MaxRows) { return(1); } int row = table.HeaderCount; IWebbTableCell cell = table.GetCell(row, index); while ((cell.MergeType & MergeTypes.Down) != MergeTypes.Down) { row++; if (row >= MaxRows) { break; } cell = table.GetCell(row, index); } if (row >= MaxRows - 1) { return(1); } row++; cell = table.GetCell(row, index); while ((cell.MergeType & MergeTypes.Merged) == MergeTypes.Merged) { count++; row++; if (row >= MaxRows || (cell.MergeType & MergeTypes.End) == MergeTypes.End) { break; } cell = table.GetCell(row, index); } return(count); }
private bool CreateMatrixPrintingTable() { if (MatrixInfo == null || !_HaveData || this.RootGroupInfo == null) { this.PrintingTable = null; return(false); } int m_Rows = MatrixInfo.GetMatrixGroupedRows(this); if (this.TableHeaders != null && this.TableHeaders.RowCount > 0 && this.TableHeaders.ColCount > 0) //2008-8-29 9:12:31@simon { m_Rows += this.TableHeaders.RowCount; //2008-8-29 9:12:37@simon } int m_Column = MatrixInfo.GetMatrixGroupedColumns(this.ShowRowIndicators); if (m_Rows <= 0 || m_Column <= 0) { this.PrintingTable = null; return(false); } System.Diagnostics.Debug.WriteLine(string.Format("Begin Create print table:{0}X{1}", m_Rows, m_Column)); this.PrintingTable = new WebbTable(m_Rows, m_Column); MatrixInfo.SetMatrixColumnWidthAtFirst(this.PrintingTable, this.ShowRowIndicators); //Set value this.HeaderRows.Clear(); this.SectionRows.Clear(); this.TotalRows.Clear(); this.BreakRows.Clear(); this.ColumnStyleRows.Clear(); this.SetTableValue(); StyleBuilder.StyleRowsInfo m_StyleInfo = new Styles.StyleBuilder.StyleRowsInfo(this._HeaderRows, this._SectionRows, this._TotalRows, this.ShowRowIndicators, this.HaveHeader); Int32Collection ignoreRows = this.HeaderRows.Combine(this.HeaderRows, this.SectionRows, this.TotalRows); StyleBuilder styleBuilder = new StyleBuilder(); #region Modify codes at 2008-11-4 15:45:04@Simon styleBuilder.BuildMatrixGroupStyle(this.PrintingTable, m_StyleInfo, this.MatrixInfo, this.Styles, ignoreRows); if (this.TableHeaders != null && this.TableHeaders.RowCount > 0 && this.TableHeaders.ColCount > 0) //Added this code at 2008-11-6 10:22:40@Simon { int minh = 0; int i_Titleindex = 0; if (this.HeaderRows.Count > 0) { foreach (int tl in this.HeaderRows) { if (i_Titleindex < tl) { i_Titleindex = tl; } } } if (i_Titleindex > minh) { foreach (int col in this.TableHeaders.ColsToMerge) { IWebbTableCell Mergedcell = PrintingTable.GetCell(i_Titleindex, col); this.PrintingTable.MergeCells(minh, i_Titleindex, col, col); IWebbTableCell bordercell = PrintingTable.GetCell(minh, col); if (this.HaveHeader) { bordercell.Text = Mergedcell.Text; bordercell.CellStyle.StringFormat = Mergedcell.CellStyle.StringFormat; if ((bordercell.CellStyle.StringFormat & StringFormatFlags.DirectionVertical) != 0) { bordercell.CellStyle.HorzAlignment = HorzAlignment.Far; bordercell.CellStyle.VertAlignment = VertAlignment.Center; } } } } } if (this.TableHeaders != null) { this.TableHeaders.SetHeadGridLine(this.PrintingTable, this.HeaderRows); } #endregion //End Modify this.ApplyColumnWidthStyle(m_Column); this.ApplyRowHeightStyle(m_Rows); switch (this.CellSizeAutoAdapting) { case CellSizeAutoAdaptingTypes.NotUse: break; case CellSizeAutoAdaptingTypes.WordWrap: this.PrintingTable.AutoAdjustMatrixSize(this.ExControl.CreateGraphics(), true, false, this.MatrixInfo, this.ShowRowIndicators); break; case CellSizeAutoAdaptingTypes.OneLine: this.PrintingTable.AutoAdjustMatrixSize(this.ExControl.CreateGraphics(), false, false, this.MatrixInfo, this.ShowRowIndicators); break; } System.Diagnostics.Debug.WriteLine("Create print table completely"); return(true); }
private void AdjustHeaderStyle() { if (this.HeaderRows.Count <= 0 || this.HeadersData == null) { return; } HeaderRows.Sort(); this.HeadersData.SetHeadGridLine(this.PrintingTable, this.HeaderRows); int MinHeaderRow = HeaderRows[0]; int MaxHeaderRow = HeaderRows[HeaderRows.Count - 1]; #region UpdateHeadeStyle for (int row = MinHeaderRow; row <= MaxHeaderRow; row++) { int TableHeaderRow = row - MinHeaderRow; if (TableHeaderRow >= this.HeadersData.RowCount) { break; } for (int col = 0; col < this.HeadersData.ColCount; col++) { HeaderCell headerCell = this.HeadersData.GetCell(TableHeaderRow, col); IWebbTableCell cell = PrintingTable.GetCell(row, col); if (headerCell == null || cell == null) { continue; } if (headerCell.NeedChangeStyle) { cell.CellStyle = headerCell.CellStyle.Copy(); } } } #endregion #region Cols In Merge foreach (int col in this.HeadersData.ColsToMerge) { IWebbTableCell Mergedcell = PrintingTable.GetCell(MaxHeaderRow, col); this.PrintingTable.MergeCells(MinHeaderRow, MaxHeaderRow, col, col); IWebbTableCell bordercell = PrintingTable.GetCell(MinHeaderRow, col); if (this.HaveHeader) { bordercell.Text = Mergedcell.Text; bordercell.CellStyle.StringFormat = Mergedcell.CellStyle.StringFormat; } if ((bordercell.CellStyle.StringFormat & StringFormatFlags.DirectionVertical) != 0) { bordercell.CellStyle.HorzAlignment = HorzAlignment.Far; bordercell.CellStyle.VertAlignment = VertAlignment.Center; } else { bordercell.CellStyle.HorzAlignment = HorzAlignment.Center; bordercell.CellStyle.VertAlignment = VertAlignment.Center; } } #endregion }