Exemplo n.º 1
0
 void PrepareSection(BaseSection section, int dataRow)
 {
     FireSectionRenderEvent(section, dataRow);
     PrintHelper.AdjustParent(section, section.Items);
     PrintHelper.AdjustSectionLocation(section);
 }
        private ExporterCollection ConvertDataRow(ISimpleContainer simpleContainer)
        {
            ExporterCollection exporterCollection = new ExporterCollection();

            base.CurrentPosition = base.SectionBounds.Offset;
            var         p       = base.CurrentPosition;
            BaseSection section = parent as BaseSection;

            DefaultLeftPosition = parent.Location.X;
            Size groupSize = Size.Empty;
            Size childSize = Size.Empty;

            if (section.Items.FindGroupHeader().Count > 0)
            {
                groupSize = section.Items[0].Size;
                childSize = section.Items[1].Size;
            }

            do
            {
                base.SaveSectionSize(section.Size);
                PrintHelper.AdjustSectionLocation(section);
                section.Size = this.SectionBounds.DetailSectionRectangle.Size;

                // did we have GroupedItems at all
                if (section.Items.FindGroupHeader().Count > 0)
                {
                    // GetType child navigator
                    IDataNavigator childNavigator = base.DataNavigator.GetChildNavigator;

                    base.Evaluator.SinglePage.IDataNavigator = childNavigator;
                    base.CurrentPosition  = ConvertGroupHeader(exporterCollection, section, base.CurrentPosition);
                    section.Size          = base.RestoreSectionSize;
                    section.Items[0].Size = groupSize;
                    section.Items[1].Size = childSize;

                    childNavigator.Reset();
                    childNavigator.MoveNext();

                    //Convert children
                    if (childNavigator != null)
                    {
                        StandardPrinter.AdjustBackColor(simpleContainer);
                        do
                        {
                            section.Size          = base.RestoreSectionSize;
                            section.Items[0].Size = groupSize;
                            section.Items[1].Size = childSize;

                            FillRow(simpleContainer, childNavigator);
                            FireRowRendering(simpleContainer, childNavigator);
                            PrepareContainerForConverting(section, simpleContainer);
                            base.CurrentPosition = ConvertStandardRow(exporterCollection, simpleContainer);
                            CheckForPageBreak(section, exporterCollection);
                        }while (childNavigator.MoveNext());

                        // GroupFooter
                        base.ConvertGroupFooter(section, exporterCollection);

                        base.PageBreakAfterGroupChange(section, exporterCollection);

                        base.Evaluator.SinglePage.IDataNavigator = base.DataNavigator;
                    }
                }
                else
                {
                    // No Grouping at all, the first item in section.items is the DetailRow
                    Size containerSize = section.Items[0].Size;
                    FillRow(simpleContainer, base.DataNavigator);
                    FireRowRendering(simpleContainer, base.DataNavigator);
                    Console.WriteLine("ConvertDazaRow");
                    base.PrepareContainerForConverting(section, simpleContainer);
                    base.CurrentPosition  = ConvertStandardRow(exporterCollection, simpleContainer);
                    section.Size          = base.RestoreSectionSize;
                    section.Items[0].Size = containerSize;
                }
                CheckForPageBreak(section, exporterCollection);
                ShouldDrawBorder(section, exporterCollection);
            }while (base.DataNavigator.MoveNext());

            SectionBounds.ReportFooterRectangle = new Rectangle(SectionBounds.ReportFooterRectangle.Left,
                                                                section.Location.Y + section.Size.Height,
                                                                SectionBounds.ReportFooterRectangle.Width,
                                                                SectionBounds.ReportFooterRectangle.Height);

            return(exporterCollection);
        }
Exemplo n.º 3
0
        private ExporterCollection ConvertInternal(ExporterCollection exporterCollection)
        {
            BaseSection section = table.Parent as BaseSection;

            ISimpleContainer headerRow     = null;
            Point            dataAreaStart = new Point(table.Items[0].Location.X, table.Items[0].Location.Y + base.CurrentPosition.Y);

            base.CurrentPosition = new Point(PrintHelper.DrawingAreaRelativeToParent(this.table.Parent, this.table).Location.X,
                                             base.SectionBounds.DetailArea.Top);

            base.DefaultLeftPosition = base.CurrentPosition.X;

            this.table.Items.SortByLocation();

            // Header

            var  simpleContainer = table.Items[0] as ISimpleContainer;
            Size containerSize   = Size.Empty;

            if (simpleContainer.Items.Count > 0)
            {
                simpleContainer.Location = new Point(simpleContainer.Location.X, simpleContainer.Location.Y);
                simpleContainer.Parent   = (BaseReportItem)this.table;

                base.SaveSectionSize(section.Size);
                containerSize = simpleContainer.Size;

                if (PrintHelper.IsTextOnlyRow(simpleContainer))
                {
                    headerRow = simpleContainer;
                    base.PrepareContainerForConverting(section, headerRow);
                    base.CurrentPosition = ConvertContainer(exporterCollection, headerRow, base.DefaultLeftPosition, base.CurrentPosition);
                }

                GroupHeader row = table.Items[1] as GroupHeader;

                if (row != null)
                {
                    //grouped
                    do
                    {
                        // GetType child navigator
                        IDataNavigator childNavigator = base.DataNavigator.GetChildNavigator;

                        base.Evaluator.SinglePage.IDataNavigator = childNavigator;
                        // Convert Grouping Header

                        base.CurrentPosition = ConvertGroupHeader(exporterCollection, section, base.CurrentPosition);

                        childNavigator.Reset();
                        childNavigator.MoveNext();

                        //Convert children
                        if (childNavigator != null)
                        {
                            do
                            {
                                StandardPrinter.AdjustBackColor(simpleContainer);
                                simpleContainer = table.Items[2] as ISimpleContainer;
                                containerSize   = simpleContainer.Size;

                                FillRow(simpleContainer, childNavigator);
                                FireRowRendering(simpleContainer, childNavigator);
                                PrepareContainerForConverting(section, simpleContainer);
                                base.CurrentPosition = ConvertStandardRow(exporterCollection, simpleContainer);

                                simpleContainer.Size = containerSize;
                                CheckForPageBreak(section, simpleContainer, headerRow, exporterCollection);
                            }while (childNavigator.MoveNext());

                            // GroupFooter
                            base.ConvertGroupFooter(table, exporterCollection);
                            base.PageBreakAfterGroupChange(section, exporterCollection);

                            base.Evaluator.SinglePage.IDataNavigator = base.DataNavigator;
                        }
                    }while (base.DataNavigator.MoveNext());
                }

                else
                {
                    // No Grouping at all

                    simpleContainer = table.Items[1] as ISimpleContainer;
                    base.SaveSectionSize(section.Size);
                    containerSize = simpleContainer.Size;

                    do
                    {
                        PrintHelper.AdjustSectionLocation(section);
                        CheckForPageBreak(section, simpleContainer, headerRow, exporterCollection);

                        FillRow(simpleContainer, base.DataNavigator);
                        FireRowRendering(simpleContainer, base.DataNavigator);
                        base.PrepareContainerForConverting(section, simpleContainer);

                        base.CurrentPosition = ConvertStandardRow(exporterCollection, simpleContainer);
                        simpleContainer.Size = containerSize;
                        section.Size         = base.RestoreSectionSize;
                    }while (base.DataNavigator.MoveNext());
                    base.DataNavigator.Reset();
                    base.DataNavigator.MoveNext();
                    SectionBounds.ReportFooterRectangle = new Rectangle(SectionBounds.ReportFooterRectangle.Left,
                                                                        base.CurrentPosition.Y,
                                                                        SectionBounds.ReportFooterRectangle.Width,
                                                                        SectionBounds.ReportFooterRectangle.Height);
                }
            }
            return(exporterCollection);
        }