QuickReport: keep Details Band and Child Band on one page

1.2k Views Asked by At

Environment: Delphi 2010, QuickReport 5.0.5

I have a report with 2 bands: Detail band and it's Child band. Problem is sometimes they are splitted on different pages.

I would like to have detail band as a header for child and keep them on the same page always.

After some hours of studying I gave up.

UPDATE: The problem was in dynamically changed height of the child band. I solved it with analyzing of the height and ForceNewPage property.

Does anybody know a solution?

2

There are 2 best solutions below

0
Garada On

Try using the detail band's LinkBand property.

If the child changes its size, you must calculate it on the parent's BeforePrint event.

0
Dżyszla On

I think, bug is in the TQRCustomBand.StretchHeight method. There are mixed size in units and in pixels:

function TQRCustomBand.StretchHeight(IncludeNext : Boolean): extended;
begin
  Result := Size.Length;
  if Assigned(FLinkBand) and IncludeNext then
    Result := Result + LinkBand.StretchHeight(True) + LinkBand.Height;
end;

I think, this is ordinary mistake and last part (+ LinkBand.Height) will be removed. But without source code (so only most expensive version) and recompile can't do this. This bug stay from version 3 and still exists in 6.