示例#1
0
        private void RunRecursiveGroups(IPresent ip, 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)
                    {
                        header.Run(ip, r);
                    }
                }

                if (_Details != null)
                {
                    _Details.Run(ip, wc.Data, iRow, iRow);
                }

                // determine need for group headers and/or footers
                if (iRow < rows.Count - 1)
                {
                    Row r2 = rows[iRow + 1];
                    if (r.Level > r2.Level)
                    {
                        if (footer != null)
                        {
                            footer.Run(ip, r);
                        }
                    }
                    else if (r.Level < r2.Level)
                    {
                        bHeader = true;
                    }
                }
            }
            if (footer != null)
            {
                footer.Run(ip, rows[rows.Count - 1] as Row);
            }
        }
示例#2
0
        override internal void Run(IPresent ip, Row row)
        {
            Report         r  = ip.Report();
            TableWorkClass wc = GetValue(r);

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

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

            if (!ip.TableStart(this, row))
            {
                return;                                                         // render doesn't want to continue
            }
            if (_TableColumns != null)
            {
                _TableColumns.Run(ip, row);
            }

            // Header
            if (_Header != null)
            {
                ip.TableHeaderStart(_Header, row);
                Row frow = wc.Data.Data.Count > 0?  wc.Data.Data[0]: null;
                _Header.Run(ip, frow);
                ip.TableHeaderEnd(_Header, row);
            }

            // Body
            ip.TableBodyStart(this, row);
            if (wc.RecursiveGroup != null)
            {
                RunRecursiveGroups(ip, wc);
            }
            else
            {
                RunGroups(ip, wc.Groups, wc);
            }
            ip.TableBodyEnd(this, row);

            // Footer
            if (_Footer != null)
            {
                ip.TableFooterStart(_Footer, row);
                Row lrow = wc.Data.Data.Count > 0?  wc.Data.Data[wc.Data.Data.Count - 1]: null;
                _Footer.Run(ip, lrow);
                ip.TableFooterEnd(_Footer, row);
            }

            ip.TableEnd(this, row);
            RemoveValue(r);
        }