예제 #1
0
        internal float HeightOfRow(Report rpt, System.Drawing.Graphics g, Row r)
        {
            WorkClass wc = GetWC(rpt);

            if (this.Visibility != null && Visibility.IsHidden(rpt, r))
            {
                wc.CalcHeight = 0;
                return(0);
            }

            float defnHeight = _Height.Points;

            if (!_CanGrow)
            {
                wc.CalcHeight = defnHeight;
                return(defnHeight);
            }

            TableColumns tcs    = this.Table.TableColumns;
            float        height = 0;

            foreach (Textbox tb in this._GrowList)
            {
                int ci = tb.TC.ColIndex;
                if (tcs[ci].IsHidden(rpt, r))    // if column is hidden don't use in calculation
                {
                    continue;
                }
                height = Math.Max(height, tb.RunTextCalcHeight(rpt, g, r));
            }
            wc.CalcHeight = Math.Max(height, defnHeight);
            return(wc.CalcHeight);
        }
예제 #2
0
        internal Table(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p, xNode)
        {
            _TableColumns             = null;
            _Header                   = null;
            _TableGroups              = null;
            _Details                  = null;
            _Footer                   = null;
            _FillPage                 = true;
            _DetailDataElementName    = "Details";
            _DetailDataCollectionName = "Details_Collection";
            _DetailDataElementOutput  = DataElementOutputEnum.Output;
            _IsGrid                   = xNode.Name != "Table"; // a grid is a restricted table to no data behind it

            // Loop thru all the child nodes
            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "TableColumns":
                    _TableColumns = new TableColumns(r, this, xNodeLoop);
                    break;

                case "Header":
                    _Header = new Header(r, this, xNodeLoop);
                    break;

                case "TableGroups":
                    _TableGroups = new TableGroups(r, this, xNodeLoop);
                    break;

                case "Details":
                    _Details = new Details(r, this, xNodeLoop);
                    break;

                case "Footer":
                    _Footer = new Footer(r, this, xNodeLoop);
                    break;

                case "FillPage":
                    _FillPage = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "DetailDataElementName":
                    _DetailDataElementName = xNodeLoop.InnerText;
                    break;

                case "DetailDataCollectionName":
                    _DetailDataCollectionName = xNodeLoop.InnerText;
                    break;

                case "DetailDataElementOutput":
                    _DetailDataElementOutput = Engine.DataElementOutput.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                default:
                    if (DataRegionElement(xNodeLoop))                                   // try at DataRegion level
                    {
                        break;
                    }
                    // don't know this element - log it
                    OwnerReport.rl.LogError(4, "Unknown " + xNode.Name + " element '" + xNodeLoop.Name + "' ignored.");
                    break;
                }
            }
            DataRegionFinish();                                 // Tidy up the DataRegion
            if (_TableColumns == null)
            {
                OwnerReport.rl.LogError(8, "TableColumns element must be specified for a " + xNode.Name + ".");
                return;
            }

            // Verify Grid restrictions
            if (_IsGrid)
            {
                if (_TableGroups != null)
                {
                    OwnerReport.rl.LogError(8, "TableGroups not allowed in Grid element '" + xNode.Name + "'.");
                }
            }

            if (OwnerReport.rl.MaxSeverity < 8)
            {
                VerifyCC();                                     // Verify column count
            }
        }
예제 #3
0
        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);
        }