Ejemplo n.º 1
0
        private void ResolveReport(Report report, Hashtable parameters)
        {
            try
            {
                SheetView    sheetView    = (SheetView)Serializer.LoadObjectXml(typeof(SheetView), Serializer.GetObjectXml(report.ReportSheet, "SheetView"), "SheetView");
                ReportEngine reportEngine = new ReportEngine(report.Configuration.DataSources, sheetView, parameters);
                PageReport   pageReport   = reportEngine.execute();

                PaginateReportIterator iterator = pageReport.generateReportPageIterator();

                DynamicValueList ColumnWidthList = ReportHelper.getColumnWidthList(pageReport.ToWorkSheet());
                DynamicValueList RowHeightList   = ReportHelper.getRowHeightList(pageReport.ToWorkSheet());

                DrawingOP drawingOP = new DrawingOP(this, pageReport, RowHeightList, ColumnWidthList);
                while (iterator.hasNext())
                {
                    ReportPage reportPage = iterator.next() as ReportPage;
                    drawingOP.DrawReport(reportPage);
                }
            }
            catch (Exception ex)
            {
                Report.Reset();
                Report.ColumnCount         = 6;
                Report.RowCount            = 2;
                Report.RowHeaderVisible    = false;
                Report.ColumnHeaderVisible = false;
                Report.Columns[0].Width    = 700;
                Report.Rows[0].Height      = 500;
                Report.Cells[0, 0].Text    = "报表解析出错:" + ex.Message;
            }
        }
Ejemplo n.º 2
0
        public void DrawReport(ReportPage reportPage)
        {
            SheetView source_report = reportPage.getSource_Report();
            Point     Point1        = new Point(0, 0);

            FT[] column_line_array = reportPage.getColumn_Line_Array();
            FT[] row_line_array    = reportPage.getRow_Line_Array();

            int PageRowIndex    = reportPage.getPageRowIndex();
            int PageColumnIndex = reportPage.getPageColumnIndex();

            int top_row_line = 0;

            if (PageRowIndex == 0 && row_line_array.Length > 0)
            {
                top_row_line = row_line_array[0].from;
            }

            int left_column_line = 0;

            if (PageColumnIndex == 0 && column_line_array.Length > 0)
            {
                left_column_line = column_line_array[0].from;
            }

            for (int i = 0; i < column_line_array.Length; i++)
            {
                FT localFT1 = column_line_array[i];
                for (int j = 0; j < row_line_array.Length; j++)
                {
                    FT localFT2 = row_line_array[j];
                    intersectCell(source_report, PageRowIndex, PageColumnIndex, top_row_line, left_column_line, localFT1, localFT2, Point1);

                    Point1.X = localFT2.to - localFT2.from + 1;
                }

                Point1.X = 0;
                Point1.Y = localFT1.to - localFT1.from + 1;
            }
        }
Ejemplo n.º 3
0
        private void dealWithReportPage(ArrayList RowFTList, ArrayList ColumnFTList, int paramInt, int rowIndex, int columnIndex)
        {
            ReportPage localReportPage = new ReportPage(this.iterator.showReport, (FT[])RowFTList.ToArray(typeof(FT)), (FT[])ColumnFTList.ToArray(typeof(FT)));
            int        i = 1;
            int        j = paramInt + i;

            if ((this.iterator.pageNumberArray != null) && (this.iterator.pageNumberArray.Length > paramInt))
            {
                j = this.iterator.pageNumberArray[paramInt];
            }
            int k = this.iterator.pageCount;

            if ((this.iterator.totalPageNumberArray != null) && (this.iterator.totalPageNumberArray.Length > paramInt))
            {
                k = this.iterator.totalPageNumberArray[paramInt];
            }
            localReportPage.setPageRowIndex(rowIndex);
            localReportPage.setPageColumnIndex(columnIndex);
            localReportPage.setCurrentPageNumber(j);
            localReportPage.setTotalPages(k);
            this.iterator.workSheetPageLists.Add(localReportPage);
        }
Ejemplo n.º 4
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();
                }
            }
        }