コード例 #1
0
        private void PrintDetailInternal(ReportPageEventArgs rpea, DataNavigator nav)
        {
            Rectangle sectionRect;

            base.PrintDetail(null, rpea);

            // no loop if there is no data
            if (!nav.HasMoreData)
            {
                rpea.PrintPageEventArgs.HasMorePages = false;
                return;
            }

            ITableContainer tableContainer = base.CurrentSection.Items[0] as ITableContainer;

            // branch to render table's etc
            if (tableContainer != null)
            {
                tableContainer.DataNavigator             = nav;
                tableContainer.Parent                    = base.CurrentSection;
                tableContainer.ExpressionEvaluatorFacade = base.ExpressionFassade;
                if (rpea.SinglePage.PageNumber == 1)
                {
                    tableContainer.StartLayoutAt(base.Sections[2]);
                }
                else
                {
                    tableContainer.StartLayoutAt(base.Sections[0]);
                }

                tableContainer.RenderTable(base.CurrentSection, this.SectionBounds, rpea, this.Layout);
                this.ReportDocument.DetailsDone = true;
            }

            else
            {
                // first element
                if (base.SinglePage.PageNumber == 1)
                {
                    this.dataNavigator.MoveNext();
                }

                do
                {
                    ISimpleContainer i = base.CurrentSection.Items[0] as ISimpleContainer;
                    if (i != null)
                    {
                        nav.Fill(i.Items);
                    }
                    else
                    {
                        nav.Fill(base.CurrentSection.Items);
                    }

                    sectionRect = new Rectangle(rpea.PrintPageEventArgs.MarginBounds.Left,
                                                base.CurrentSection.SectionOffset,
                                                rpea.PrintPageEventArgs.MarginBounds.Width,
                                                base.CurrentSection.Size.Height);


                    if (PrintHelper.IsPageFull(sectionRect, base.SectionBounds))
                    {
                        AbstractRenderer.PageBreak(rpea);
                        this.RemoveSectionEvents();
                        return;
                    }

                    base.RenderItems(rpea);


                    if (nav.CurrentRow < nav.Count - 1)
                    {
                        if (base.CurrentSection.PageBreakAfter)
                        {
                            AbstractRenderer.PageBreak(rpea);
                            this.RemoveSectionEvents();

                            return;
                        }
                    }

                    Rectangle r = new Rectangle(rpea.PrintPageEventArgs.MarginBounds.Left,
                                                base.CurrentSection.SectionOffset,
                                                rpea.PrintPageEventArgs.MarginBounds.Width,
                                                base.CurrentSection.Size.Height);


//					if (this.dataNavigator.CurrentRow % 2 == 0) {
//					PrintHelper.DebugRectangle(rpea.PrintPageEventArgs.Graphics,r);
//					}

                    base.CurrentSection.SectionOffset = r.Bottom;
                    rpea.LocationAfterDraw            = new Point(rpea.LocationAfterDraw.X,
                                                                  sectionRect.Bottom);

                    rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X,
                                                       r.Bottom);
                }while (nav.MoveNext());
                this.ReportDocument.DetailsDone = true;
            }

            rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X, rpea.LocationAfterDraw.Y + 5);
            if (!PrintHelper.IsRoomForFooter(base.SectionBounds, rpea.LocationAfterDraw))
            {
                AbstractRenderer.PageBreak(rpea);
            }
        }