コード例 #1
0
ファイル: Table.cs プロジェクト: isgmbh/UniERM-ReportDesigner
        override internal void RunPage(Pages pgs, Row row)
        {
            Report r = pgs.Report;

            if (IsHidden(r, row))
            {
                return;
            }

            TableWorkClass wc = GetValue(r);

            if (_IsGrid)
            {
                wc.Data = Rows.CreateOneRow(r);
            }
            else
            {
                wc.Data = GetFilteredData(r, row);
            }

            SetPagePositionBegin(pgs);

            if (!AnyRowsPage(pgs, wc.Data))                     // if no rows return
            {
                return;                                         //   nothing left to do
            }
            RunPrep(r, row, wc);

            RunPageRegionBegin(pgs);

            Page p = pgs.CurrentPage;

            p.YOffset += this.RelativeY(r);

            // Calculate the xpositions of the columns
            TableColumns.CalculateXPositions(r, GetOffsetCalc(r) + LeftCalc(r), row);

            RunPageHeader(pgs, wc.Data.Data[0], true, null);

            if (wc.RecursiveGroup != null)
            {
                RunRecursiveGroupsPage(pgs, wc);
            }
            else
            {
                RunGroupsPage(pgs, wc, wc.Groups, wc.Data.Data.Count - 1, 0);
            }

            // Footer
            if (_Footer != null)
            {
                Row lrow = wc.Data.Data.Count > 0?  wc.Data.Data[wc.Data.Data.Count - 1]: null;
                p = pgs.CurrentPage;
                // make sure the footer fits on the page
                if (p.YOffset + _Footer.HeightOfRows(pgs, lrow) > pgs.BottomOfPage)
                {
                    p = RunPageNew(pgs, p);
                    RunPageHeader(pgs, row, false, null);
                }
                _Footer.RunPage(pgs, lrow);
            }

            RunPageRegionEnd(pgs);

            SetPagePositionEnd(pgs, pgs.CurrentPage.YOffset);
            RemoveValue(r);
        }
コード例 #2
0
ファイル: Table.cs プロジェクト: isgmbh/UniERM-ReportDesigner
        private void RunRecursiveGroupsPage(Pages pgs, TableWorkClass wc)
        {
            List <Row> rows = wc.Data.Data;
            Row        r;

            // Get any header/footer information for use in loop
            Header     header = null;
            Footer     footer = null;
            TableGroup tg     = wc.RecursiveGroup.Parent as TableGroup;

            if (tg != null)
            {
                header = tg.Header;
                footer = tg.Footer;
            }

            bool bHeader = true;

            for (int iRow = 0; iRow < rows.Count; iRow++)
            {
                r = rows[iRow];
                wc.Data.CurrentGroups[0] = r.GroupEntry;
                wc.GroupNestCount        = r.GroupEntry.EndRow - r.GroupEntry.StartRow;
                if (bHeader)
                {
                    bHeader = false;
                    if (header != null)
                    {
                        Page  p      = pgs.CurrentPage;                                         // this can change after running a row
                        float height = p.YOffset + header.HeightOfRows(pgs, r);
                        if (height > pgs.BottomOfPage)
                        {
                            p = RunPageNew(pgs, p);
                            RunPageHeader(pgs, r, false, null);
                            if (!header.RepeatOnNewPage)
                            {
                                header.RunPage(pgs, r);
                            }
                        }
                        else
                        {
                            header.RunPage(pgs, r);
                        }
                    }
                }

                // determine need for group headers and/or footers
                bool  bFooter      = false;
                float footerHeight = 0;

                if (iRow < rows.Count - 1)
                {
                    Row r2 = rows[iRow + 1];
                    if (r.Level > r2.Level)
                    {
                        if (footer != null)
                        {
                            bFooter      = true;
                            footerHeight = footer.HeightOfRows(pgs, r);
                        }
                    }
                    else if (r.Level < r2.Level)
                    {
                        bHeader = true;
                    }
                }

                if (_Details != null)
                {
                    _Details.RunPage(pgs, wc.Data, iRow, iRow, footerHeight);
                }

                // and output the footer if needed
                if (bFooter)
                {
                    footer.RunPage(pgs, r);
                }
            }
            if (footer != null)
            {
                footer.RunPage(pgs, rows[rows.Count - 1] as Row);
            }
        }