FPReport: vpLastOnly is not printed if report output is 1 page only
Original Reporter info from Mantis: Doyenne
-
Reporter name:
Original Reporter info from Mantis: Doyenne
- Reporter name:
Description:
In FPReport, a band's VisibleOnPage property determines on what pages the band is printed. If you set it to vpLastOnly, the band is only printed on the last output page (TFPReport.TwoPass must be True to know which output page is the last page).
However, if the report has only 1 output page, a band with VisibleOnPage = vpLastOnly is not printed. In my opinion, this is incorrect.
If there is only 1 output page, that page &LtPos;i>is&LtPos;/i> the last page, so the band should be printed. In practice, vpLastOnly turns out to be useful for a summary, totals, concluding remark and so on and as such, should be printed on page 1 if there is only 1 output page.
The code that evaluates whether or not to print a band, is in fpreport.pp lines 9430+:
function TFPReportCustomBand.EvaluateVisibility: boolean;
begin
Result := inherited EvaluateVisibility;
if not Result then
exit;
Result := False;
if FVisibleOnPage = vpAll then
begin
// do nothing special
end
else if (Report.FPageNumberPerDesignerPage = 1) then
begin // first page rules
if (FVisibleOnPage in [vpFirstOnly, vpFirstAndLastOnly]) then
begin
// do nothing special
end
else if (FVisibleOnPage in [vpNotOnFirst, vpLastOnly, vpNotOnFirstAndLast]) then <b>// <----- this line is wrong</b>
Exit; // user asked to skip this band
end
This can be corrected as follows:
function TFPReportCustomBand.EvaluateVisibility: boolean;
begin
Result := inherited EvaluateVisibility;
if not Result then
exit;
Result := False;
if FVisibleOnPage = vpAll then
begin
// do nothing special
end
else if (Report.FPageNumberPerDesignerPage = 1) then
begin // first page rules
if (FVisibleOnPage in [vpFirstOnly, vpFirstAndLastOnly]) then
begin
// do nothing special
end
else if (FVisibleOnPage in [vpNotOnFirst, vpNotOnFirstAndLast]) then
Exit // user asked to skip this band
else if (not Report.IsFirstPass) then
begin // Last page rules
if (FVisibleOnPage in [vpLastOnly]) and (Report.FPageNumberPerDesignerPage < Report.FPerDesignerPageCount[Report.FRTCurDsgnPageIdx]) then
Exit; // user asked to skip this band
end;
end
Mantis conversion info:
- Mantis ID: 35095
- Monitored by: » Doyenne (Doyenne)