Exemple #1
0
        public override void Render(RdlRender.Container box)
        {
            RdlRender.FixedContainer headerBox  = null;
            RdlRender.FlowContainer  detailsBox = null;
            RdlRender.FixedContainer footerBox  = null;

            base.Render(box);

            bool visible = true;

            if (_visibility != null && _visibility.IsHidden && _visibility.ToggleItem == null)
            {
                visible = false;
            }
            if (box != null && visible)
            {
                _box      = box.AddFlowContainer(this, Style);
                _box.Name = _name;
                if (IsInCell)
                {
                    _box.Width             = box.Width;
                    _box.MatchParentHeight = true;
                }
                else
                {
                    _box.Top    = _top.points;
                    _box.Left   = _left.points;
                    _box.Width  = (_width == null) ? box.Width : _width.points;
                    _box.Height = _height.points;
                }
                _box.CanGrowHorizonally = false;

                if (_header != null)
                {
                    headerBox      = _box.AddFixedContainer(this, _header.Style);
                    headerBox.Name = "TableHeader";
                }
                if (_details != null)
                {
                    detailsBox      = _box.AddFlowContainer(this, _details.Style);
                    detailsBox.Name = "TableDetails";
                }
                if (_footer != null)
                {
                    footerBox      = _box.AddFixedContainer(this, _footer.Style);
                    footerBox.Name = "TableFooter";
                }
            }

            if (_header != null)
            {
                _header.Render(headerBox);
            }
            if (_details != null)
            {
                if (detailsBox != null)
                {
                    detailsBox.Top = headerBox.Height;
                }
                _details.Render(detailsBox);
            }
            if (_footer != null)
            {
                if (footerBox != null)
                {
                    footerBox.Top = detailsBox.Top + detailsBox.Height;
                }
                _footer.Render(footerBox);
            }

            // If the header or footer are reoeated, then add them to the repeat list of the details.
            if (_header != null && _header.RepeatOnNewPage && _box != null)
            {
                detailsBox.RepeatList.Add(headerBox);
            }
            if (_footer != null && _footer.RepeatOnNewPage && _box != null)
            {
                detailsBox.RepeatList.Add(footerBox);
            }
        }
Exemple #2
0
        public override void Render(RdlRender.Container box)
        {
            RdlRender.FixedContainer headerBox  = null;
            RdlRender.FlowContainer  detailsBox = null;
            RdlRender.FixedContainer footerBox  = null;
            RdlRender.FlowContainer  groupRow   = null;

            _context = new RdlRuntime.Context(
                ParentContext(null),
                null,
                null,
                _grouping,
                _sortBy);

            base.Render(box);

            if (box != null)
            {
                _box = box.AddFlowContainer(this, Style);
                _box.CanGrowVertically = true;
                _box.Width             = box.Width;
                _box.Name = "TableGroup";
            }

            // Render the header
            decimal groupTop = 0;

            while (_context.GroupIndex < _context.GroupCount)
            {
                if (_box != null)
                {
                    groupRow = _box.AddFlowContainer(this, Style);
                    groupRow.CanGrowVertically = true;
                    groupRow.Width             = _box.Width;
                    groupRow.Top         = groupTop;
                    groupRow.Name        = "GroupRrow";
                    groupRow.ContextBase = true;
                }

                if (_header != null)
                {
                    if (_box != null)
                    {
                        headerBox     = groupRow.AddFixedContainer(this, _header.Style);
                        headerBox.Top = 0;
                        headerBox.CanGrowVertically = true;
                        headerBox.Width             = groupRow.Width;
                        headerBox.Name = "GroupHeader";
                    }

                    _header.Render(headerBox);
                }

                // Create a box to hold the details and tie that
                // box to any repeat lists referencing these details.
                if (_details != null && groupRow != null)
                {
                    detailsBox     = groupRow.AddFlowContainer(this, _details.Style);
                    detailsBox.Top = (headerBox == null)?0:headerBox.Height;
                    detailsBox.CanGrowVertically = true;
                    detailsBox.Width             = groupRow.Width;
                    detailsBox.Name = "GroupDetails";

                    // If the header or footer are repeated, then add them to the repeat list of the details.
                    if (_header != null && _header.RepeatOnNewPage)
                    {
                        detailsBox.RepeatList.Add(headerBox);
                    }
                    if (_footer != null && _footer.RepeatOnNewPage)
                    {
                        detailsBox.RepeatList.Add(footerBox);
                    }
                }

                // Render the details.
                if (_details != null)
                {
                    _details.Render(detailsBox);
                }

                // Render the footer.
                if (_footer != null)
                {
                    if (groupRow != null)
                    {
                        footerBox      = groupRow.AddFixedContainer(this, _footer.Style);
                        footerBox.Name = "GroupFooter";
                        footerBox.CanGrowVertically = true;
                        footerBox.Top = ((headerBox == null) ? 0 : headerBox.Height) +
                                        ((detailsBox == null) ? 0 : detailsBox.Height);
                        footerBox.Width = _box.Width;
                    }
                    _context.RowIndex = 0;
                    _footer.Render(footerBox);
                }

                if (groupRow != null)
                {
                    groupTop += groupRow.Height;
                }

                _context.NextGroup();
            }
        }