override public bool PrintNextPage() { int i; if (ErrorProcessing) { throw new UnNamedException("Error processing\n" + LastErrorProcessing); } PageNum++; PageNumGroup++; // Updates page size, and orientation if (MetaFile.Pages.CurrentCount <= PageNum) { if (TwoPass) { MetaFile.ForwardOnly = false; } MetaFile.Pages.Add(new MetaPage(MetaFile)); } MetaFile.CurrentPage = PageNum; DoUpdatePageSize(MetaFile.Pages[MetaFile.Pages.CurrentCount - 1]); FGroupHeaders.Clear(); PrintedSomething = false; if (section == null) { throw new UnNamedException("Last sectoin reached"); } if (subreport != null) { for (i = 0; i < SubReports.Count; i++) { SubReports[i].SubReportChanged(SubReportEvent.PageChange, ""); } } havepagefooters = false; sectionextevaluated = false; oldprintedsection = null; if (!FCompose) { FreeSpace = InternalPageHeight; FreeSpace = FreeSpace - TopMargin - BottomMargin; pageposy = TopMargin; pageposx = LeftMargin; } else { if ((GHeaders.Count > 0) || (subreport.PageHeaderCount > 0)) { MetaFile.Pages.Add(new MetaPage(MetaFile)); PageNum++; MetaFile.CurrentPage = MetaFile.Pages.CurrentCount - 1; FreeSpace = InternalPageHeight; FreeSpace = FreeSpace - TopMargin - BottomMargin; pageposy = TopMargin; pageposx = LeftMargin; DoUpdatePageSize(MetaFile.Pages[MetaFile.Pages.CurrentCount - 1]); } else { PrintedSomething = true; } //FCompose = false; } pagespacex = InternalPageWidth; int oldhorzdespposition = LeftMargin; pagefooters = new Sections(); try { Point MaxExtent = new Point(); bool PartialPrint; // Fills the page with fixed sections PrintFixedSections(true); // Group headers with child subreports if (FGroupHeaders.Count > 0) { PendingSections.Add(section); section = FGroupHeaders[0]; } oldsubreport = subreport; Point lastvertpos = new Point(); lastvertpos.X = pageposx; lastvertpos.Y = pageposy; while (section != null) { if (PrintedSomething) { if (section.EvaluateBeginPage()) { break; } } asection = section; // Horz.Desp. if (oldprintedsection != null) { if (oldprintedsection.HorzDesp) { if (section.HorzDesp) { MaxExtent.X = pagespacex; MaxExtent.Y = FreeSpace; sectionext = section.GetExtension(FDriver, MaxExtent, false); sectionextevaluated = true; if ((pageposx + oldprintedsectionext.X + sectionext.X) <= pagespacex) { pageposx = pageposx + oldprintedsectionext.X; pageposy = pageposy - oldprintedsectionext.Y; FreeSpace = FreeSpace + oldprintedsectionext.Y; } else { pageposx = LeftMargin; } } else { pageposx = oldhorzdespposition; } } else { oldhorzdespposition = pageposx; } } if (!CheckSpace()) { // If the current section have vert desp, do // a vertical and horz. desp if possible if (section.VertDesp) { // Go to old vertical position if fits horizontally MaxExtent.X = pagespacex; MaxExtent.Y = lastvertpos.Y - BottomMargin; sectionext = section.GetExtension(FDriver, MaxExtent, false); sectionextevaluated = true; if ((pageposx + sectionext.X * 2) <= pagespacex) { FreeSpace = FreeSpace + (pageposy - lastvertpos.Y); pageposx = pageposx + sectionext.X; pageposy = lastvertpos.Y; } else { pageposx = LeftMargin; break; } if (!CheckSpace()) { break; } } else { break; } } PartialPrint = false; PrintSection(true, ref PartialPrint); if (!PartialPrint) { if (!section.VertDesp) { lastvertpos.X = pageposx; lastvertpos.Y = pageposy; } NextSection(true); if (section != null) { if (!section.VertDesp) { lastvertpos.X = pageposx; lastvertpos.Y = pageposy; } } } if (PrintedSomething) { if (asection.SkipPage) { break; } } // if Subreport changed and has have pagefooter if ((oldsubreport != subreport) && (havepagefooters)) { break; } oldsubreport = subreport; } // Fills the page with fixed sections if (PrintedSomething) { if (oldprintedsection != null) { if (oldprintedsection.HorzDesp) { pageposx = oldhorzdespposition; } } } PrintFixedSections(false); pagefooters = null; } catch (Exception E) { pagefooters = null; ErrorProcessing = true; LastErrorProcessing = E.Message; throw; } bool aresult = (section == null); LastPage = aresult; if (LastPage) { MetaFile.Finish(); CheckProgress(true); } if (aresult) { EndPrint(); } return(aresult); }