Exemplo n.º 1
0
        public void intersectCell(SheetView source_report, int pageRowIndex, int pageColumnIndex, int top_row_line, int left_column_line, FT localFT1, FT localFT2, Point Point1)
        {
            List <Cell> Cells         = new List <Cell>();
            Rectangle   rect          = PageRectangles[pageRowIndex - 1, pageColumnIndex - 1];
            SheetView   target_report = reportPanel.Report;

            for (int i = localFT2.from; i <= localFT2.to; i++)
            {
                for (int j = localFT1.from; j <= localFT1.to; j++)
                {
                    Cell      source_cell     = source_report.Cells[i, j];
                    CellRange source_spancell = source_report.GetSpanCell(i, j);
                    if (source_spancell != null)
                    {
                        source_cell = source_report.Cells[source_spancell.Row, source_spancell.Column];
                    }

                    if (!Cells.Contains(source_cell))
                    {
                        Cells.Add(source_cell);
                    }
                    else
                    {
                        continue;
                    }

                    Cell target_cell = target_report.Cells[rect.X + i - localFT2.from + Point1.X, rect.Y + j - localFT1.from + Point1.Y];

                    if (source_cell.Row.Index + source_cell.RowSpan > localFT2.to)
                    {
                        target_cell.RowSpan = localFT2.to - source_cell.Row.Index + 1;
                    }
                    else if (source_cell.Row.Index < localFT2.from)
                    {
                        target_cell.RowSpan = source_cell.Row.Index + source_cell.RowSpan - localFT2.from;
                    }
                    else
                    {
                        target_cell.RowSpan = source_cell.RowSpan;
                    }

                    if (source_cell.Column.Index + source_cell.ColumnSpan > localFT1.to)
                    {
                        target_cell.ColumnSpan = localFT1.to - source_cell.Column.Index + 1;
                    }
                    else if (source_cell.Column.Index < localFT1.from)
                    {
                        target_cell.ColumnSpan = source_cell.Column.Index + source_cell.ColumnSpan - localFT1.from;
                    }
                    else
                    {
                        target_cell.ColumnSpan = source_cell.ColumnSpan;
                    }

                    target_cell.Value = source_cell.Value;

                    target_cell.CellType  = source_cell.CellType;
                    target_cell.BackColor = source_cell.BackColor;

                    target_cell.Border = GetNewBorder(source_cell, true, true, true, true);

                    target_cell.ForeColor           = source_cell.ForeColor;
                    target_cell.Font                = source_cell.Font;
                    target_cell.HorizontalAlignment = source_cell.HorizontalAlignment;
                    target_cell.VerticalAlignment   = source_cell.VerticalAlignment;
                }
            }
        }