Print ReportSummary band at bottom of page
Hi All,
By default report summary bands print immediately after any other bands, at the end of the report. I want it to print at the bottom of the last page.
Searching through the forums the only suggestion I have found is to use the page footer band instead of the report summary band. This is not helpful, I am already using the page footer in some of the reports PLUS the report summary is quite large and I dont want to steal that much of all the pages PLUS the report summary in some cases is not really appropriate for printing on every page.
I did manage to work out a script that achieves the desired result, see below, but I would much rather have a simpler (property based) method to save having to copy this script to every report where I want this feature.
So my questions become: Is there a simpler way that I have missed? If not, is this a feature that may get implemented any time soon? If not, can you give me a hint about where in the FR source I could implement this for myself?
The script that follows is written as a separate procedure to make it easier to copy from report to report. What it does is resize the given band to take up all (except 0.1cm) of the available freespace on the page, and then move all view objects on that band so they appear at the bottom. The "SizerView" parameter is expected to be a view object on the band that statically defines the minimum height of the band (I use a blank memo for this purpose) which gives the procedure a means of determining the adjustment required on all views in the band. I expect that there may be some situations where this will not work, but so far its been OK.
By default report summary bands print immediately after any other bands, at the end of the report. I want it to print at the bottom of the last page.
Searching through the forums the only suggestion I have found is to use the page footer band instead of the report summary band. This is not helpful, I am already using the page footer in some of the reports PLUS the report summary is quite large and I dont want to steal that much of all the pages PLUS the report summary in some cases is not really appropriate for printing on every page.
I did manage to work out a script that achieves the desired result, see below, but I would much rather have a simpler (property based) method to save having to copy this script to every report where I want this feature.
So my questions become: Is there a simpler way that I have missed? If not, is this a feature that may get implemented any time soon? If not, can you give me a hint about where in the FR source I could implement this for myself?
The script that follows is written as a separate procedure to make it easier to copy from report to report. What it does is resize the given band to take up all (except 0.1cm) of the available freespace on the page, and then move all view objects on that band so they appear at the bottom. The "SizerView" parameter is expected to be a view object on the band that statically defines the minimum height of the band (I use a blank memo for this purpose) which gives the procedure a means of determining the adjustment required on all views in the band. I expect that there may be some situations where this will not work, but so far its been OK.
 procedure MoveToEndOfPage(TheBand: TfrxBand; SizerView: TfrxView);
 var
  i, lim: integer;
  d: extended;
  obj: TObject;
  vw: TfrxView;
 begin
  TheBand.Height := Engine.Freespace - (fr1cm * 0.1);
  d := (TheBand.Height - SizerView.Height) - SizerView.Top;
  lim := TheBand.Objects.Count - 1;
  for i := 0 to lim do
  begin
   obj := TheBand.Objects[i];
   if obj is TfrxView then
   begin
    vw := TfrxView(obj);
    vw.Top := vw.Top + d;
   end;
  end;
 end;
The script is used by a simple call from the OnBeforePrint event of the report summary band. eg:
 procedure StatementSummaryOnBeforePrint(Sender: TfrxComponent);
 begin
  MoveToEndOfPage(StatementSummary, SummarySize);
 end;
Comments
procedure ReportSummary1OnBeforePrint(Sender: TfrxComponent);
begin
Engine.CurY := Engine.CurY + Engine.FreeSpace - ReportSummary1.Height - 1;
end;
You suggested:
That is much simpler, and it works!
I had tried something similar - setting the ReportSummary.Top property - but that did not work which is how I ended up with the longer code.
Thank you very much.