Exemple #1
0
        protected void DoPageInfo()
        {
            SheetView source_report   = reportPanel.Report;
            FpSpread  source_fpspread = reportPanel.ReportSpread;

            source_report.PrintInfo.CopyFrom(pageReport.getReportSettings());

            source_report.Rows.Count    = 0;
            source_report.Columns.Count = 0;

            Dictionary <int, int> pageRowIndexs    = new Dictionary <int, int>();
            Dictionary <int, int> pageColumnIndexs = new Dictionary <int, int>();

            while (iterator.hasNext())
            {
                ReportPage reportPage = iterator.next() as ReportPage;

                float[] columns = reportPage.getColumnWidthArray();
                float[] rows    = reportPage.getRowHeightArray();

                if (!pageColumnIndexs.ContainsKey(reportPage.getPageColumnIndex()))
                {
                    pageColumnIndexs.Add(reportPage.getPageColumnIndex(), source_report.Columns.Count);

                    source_report.Columns.Add(source_report.Columns.Count, columns.Length);
                    for (int i = columns.Length - 1; i >= 0; i--)
                    {
                        source_report.Columns[source_report.Columns.Count - 1 - i].Width = columns[columns.Length - 1 - i];
                    }

                    source_report.Columns[pageColumnIndexs[reportPage.getPageColumnIndex()]].PageBreak = true;
                }

                if (!pageRowIndexs.ContainsKey(reportPage.getPageRowIndex()))
                {
                    pageRowIndexs.Add(reportPage.getPageRowIndex(), source_report.Rows.Count);

                    source_report.Rows.Add(source_report.Rows.Count, rows.Length);
                    for (int i = rows.Length - 1; i >= 0; i--)
                    {
                        source_report.Rows[source_report.Rows.Count - 1 - i].Height = rows[rows.Length - 1 - i];
                    }

                    source_report.Rows[pageRowIndexs[reportPage.getPageRowIndex()]].PageBreak = true;
                }

                Rectangle Rect = new Rectangle();
                Rect.X      = pageRowIndexs[reportPage.getPageRowIndex()];
                Rect.Y      = pageColumnIndexs[reportPage.getPageColumnIndex()];
                Rect.Width  = rows.Length;
                Rect.Height = columns.Length;
                PageRectangles[reportPage.getPageRowIndex() - 1, reportPage.getPageColumnIndex() - 1] = Rect;
            }

            int FloatColumnCount = 0, FloatRowCount = 0;

            foreach (IElement Shape in pageReport.ToWorkSheet().DrawingContainer.ContainedObjects)
            {
                if (Shape is FloatElement)
                {
                    FloatElement localFloatElement = Shape as FloatElement;
                    Point[]      arrayOfPoint      = ReportHelper.calculateLastColumnAndRowOfFloatElement(pageReport.ToWorkSheet(), localFloatElement);
                    FloatColumnCount = Math.Max(FloatColumnCount, arrayOfPoint[0].X);
                    FloatRowCount    = Math.Max(FloatRowCount, arrayOfPoint[0].Y);
                }
            }

            if (source_report.Columns.Count < FloatColumnCount)
            {
                source_report.Columns.Add(source_report.Columns.Count, FloatColumnCount - source_report.Columns.Count);
            }
            if (source_report.Rows.Count < FloatRowCount)
            {
                source_report.Rows.Add(source_report.Rows.Count, FloatRowCount - source_report.Rows.Count);
            }

            foreach (IElement Shape in pageReport.ToWorkSheet().DrawingContainer.ContainedObjects)
            {
                if (Shape is FloatElement)
                {
                    FloatElement localFloatElement = Shape as FloatElement;
                    FloatElement tmpfloatElement   = localFloatElement.Clone() as FloatElement;
                    tmpfloatElement.Locked = true;
                    source_report.AddShape(tmpfloatElement);
                    tmpfloatElement.Update();
                }
            }
        }