internal void AddToPreparedPages(BandBase band) { bool isReportSummary = band is ReportSummaryBand; // check if band is service band (e.g. page header/footer/overlay). BandBase mainBand = band; // for child bands, check its parent band. if (band is ChildBand) { mainBand = (band as ChildBand).GetTopParentBand; } bool isPageBand = mainBand is PageHeaderBand || mainBand is PageFooterBand || mainBand is OverlayBand; bool isColumnBand = mainBand is ColumnHeaderBand || mainBand is ColumnFooterBand; // check if we have enough space for a band. bool checkFreeSpace = !isPageBand && !isColumnBand && band.FlagCheckFreeSpace; if (checkFreeSpace && FreeSpace < band.Height) { // we don't have enough space. What should we do? // - if band can break, break it // - if band cannot break, check the band height: // - it's the first row of a band and is bigger than page: break it immediately. // - in other case, add a new page/column and tell the band that it must break next time. if (band.CanBreak || band.FlagMustBreak || (band.AbsRowNo == 1 && band.Height > PageHeight - PageFooterHeight)) { // since we don't show the column footer band in the EndLastPage, do it here. if (isReportSummary) { ShowReprintFooters(); ShowBand(page.ColumnFooter); } BreakBand(band); return; } else { EndColumn(); band.FlagMustBreak = true; AddToPreparedPages(band); band.FlagMustBreak = false; return; } } else { // since we don't show the column footer band in the EndLastPage, do it here. if (isReportSummary) { if ((band as ReportSummaryBand).KeepWithData) { EndKeep(); } ShowReprintFooters(false); ShowBand(page.ColumnFooter); } } // check if we have a child band with FillUnusedSpace flag if (band.Child != null && band.Child.FillUnusedSpace) { // if we reprint a data/group footer, do not include the band height into calculation: // it is already counted in FreeSpace float bandHeight = band.Height; if (band.Repeated) { bandHeight = 0; } while (FreeSpace - bandHeight - band.Child.Height >= 0) { float saveCurY = CurY; ShowBand(band.Child); // nothing was printed, break to avoid an endless loop if (CurY == saveCurY) { break; } } } // adjust the band location if (band is PageFooterBand && !UnlimitedHeight) { CurY = PageHeight - GetBandHeightWithChildren(band); } if (!isPageBand) { band.Left += originX + CurX; } if (band.PrintOnBottom) { CurY = PageHeight - PageFooterHeight - ColumnFooterHeight; // if PrintOnBottom is applied to a band like DataFooter, print it with all its child bands // if PrintOnBottom is applied to a child band, print this band only. if (band is ChildBand) { CurY -= band.Height; } else { CurY -= GetBandHeightWithChildren(band); } } band.Top = CurY; // shift the band and decrease its width when printing hierarchy float saveLeft = band.Left; float saveWidth = band.Width; if (!isPageBand && !isColumnBand) { band.Left += hierarchyIndent; band.Width -= hierarchyIndent; } // add outline AddBandOutline(band); // add bookmarks band.AddBookmarks(); // put the band to prepared pages. Do not put page bands twice // (this may happen when we render a subreport, or append a report to another one). bool bandAdded = true; bool bandAlreadyExists = false; if (isPageBand) { if (band is ChildBand) { bandAlreadyExists = PreparedPages.ContainsBand(band.Name); } else { bandAlreadyExists = PreparedPages.ContainsBand(band.GetType()); } } if (!bandAlreadyExists) { bandAdded = PreparedPages.AddBand(band); } // shift CurY if (bandAdded && !(mainBand is OverlayBand)) { CurY += band.Height; } // set left&width back band.Left = saveLeft; band.Width = saveWidth; }