在 FastReport VCL 5 的上方添加 space

Add space above band in FastReport VCL 5

我有一个正在处理的发票表格,我使用页眉带作为主数据(以便发票抬头信息出现在每一页上),然后使用主带显示行项目发票,最后是另一个显示总计的主带(总计以多种货币打印)。我想从第一个 space 第二个主乐队,但我看不出有什么办法可以做到这一点。

PAGE HEADER (with invoice header)
MASTER DATA BAND (with invoice detail)
<need space here>
MASTER DATA BAND (with invoice totals)
FOOTER
PAGE FOOTER

更新: 以下是我的报告中条带的布局方式:

如果我将建议的代码放在 MasterData:Totals OnBeforePrint 中,那么这就是我得到的(我使用 40 而不是 5 来使区别明显):

下面是没有代码的样子:

这是我的代码:

procedure TotalsOnBeforePrint(Sender: TfrxComponent);
begin
  if Engine.FreeSpace > Totals.Height + Footer.Height + PageFooter.Height + 40 then
    Engine.CurY := Engine.CurY + 40;  
end;

(我把if语句中的符号翻转了,否则它几乎不会执行。)

如果detail total band是固定高度,可以使用band的OnBeforePrint(脚本)。我使用了值 5 - 在带打印之前将其设置为您想要的任何间距:

procedure MasterDataTotalBandBeforePrint(Sender: TfrxComponent);
begin
  // See if there's room for the band between the bottom of the last
  // band (MasterDataDetail) and the footer and page footer.

  if Engine.FreeSpace > MasterDataTotalBand.Height + FooterBand1.Height +
                        PageFooter1.Height + 5 then
    Engine.CurY := Engine.CurY + 5;
end;

将空子带添加到主数据带 在 Child 的 OnBeforePrint 事件中使用:

Child1.Visible := 不是 Totals.Dataset.Eof;

根据@gpi 的评论,我向 MasterData:MasterData 带(技术上是 TariffRemarks 带的子带)添加了一个子带(名为 Spacer)。然后,我将以下脚本添加到该儿童乐队的 OnBeforePrint 事件中:

procedure SpacerOnBeforePrint(Sender: TfrxComponent);
begin
  Spacer.Visible := MasterData.Dataset.RecNo = MasterData.Dataset.RecordCount - 1;
end;

这行得通。我不确定为什么 MasterData.Dataset.eof 不起作用,但我认为最后一条记录的 OnBeforePrint 事件在 table 前进到最后一条记录并将 eof 标志设置为真之前触发。我想 Recno 是基于 0 的,所以 MasterData.Dataset.Recno = MasterData.Dataset.Recordcount 也不起作用。