Ejemplo n.º 1
0
        protected ExporterCollection ConvertSection(BaseSection section, int dataRow)
        {
            FireSectionRenderEvent(section, dataRow);

            PrintHelper.AdjustParent((BaseSection)section, section.Items);

            ExporterCollection list = new ExporterCollection();

            if (section.Items.Count > 0)
            {
                Point offset = new Point(section.Location.X, section.SectionOffset);

                // Call layouter only once per section
                Rectangle desiredRectangle = Layouter.Layout(this.Graphics, section);
                Rectangle sectionRectangle = new Rectangle(section.Location, section.Size);
                if (!sectionRectangle.Contains(desiredRectangle))
                {
                    section.Size = new Size(section.Size.Width, desiredRectangle.Size.Height + GlobalValues.ControlMargins.Top + GlobalValues.ControlMargins.Bottom);
                }

                foreach (BaseReportItem item in section.Items)
                {
                    ISimpleContainer container = item as ISimpleContainer;

                    if (container != null)
                    {
                        ExportContainer exportContainer = StandardPrinter.ConvertToContainer(container, offset);

                        StandardPrinter.AdjustBackColor(container);

                        ExporterCollection clist = StandardPrinter.ConvertPlainCollection(container.Items, offset);

                        exportContainer.Items.AddRange(clist);
                        list.Add(exportContainer);
                    }
                    else
                    {
                        list = StandardPrinter.ConvertPlainCollection(section.Items, offset);
                    }
                }
            }
            return(list);
        }