每页都打印20行,当不够时,打印出空白表格!
这是怎么实现的呢?下面我说一下实现原理,报表通过FastReport实现
第一步:报表中需要用到的组建
PAGEHEADER,MasterData,Child(通过右键点击MasterData>Add child band),Footer
在Child中用MEMO画空白表格,显示的样式和MaterData中的数据样式相同!
第二步:在工具箱左上角有选项卡,选择CODE选项卡,打开代码模块!
第三步:在BEGIN
END.的上面声明变量
此时代码模块的样子
var
PageLine: integer; //在現在頁列印到第幾行
PageMaxRow: integer=15; //設定每頁列數
Begin
End.
第四步:在工具箱左上角选项卡中,切换到PAGE1选项卡,打开页面模块!
第五步:选择MasterData,在工具箱左上角点Events(事件)→OnBeforePrint,双击,进入该事件代码区域
写入代码
Begin
PageLine :=
if (PageLine = 1) and (
Engine.newpage;
child1.visible := False;
End;
第六步:选择Footer,在工具箱左上角点Events(事件),→OnBeforePrint,双击,进入该事件代码区域
写入代码
var
i: integer;
begin
i := iif(PageLine=0, PageMaxRow, PageLine);
child1.visible := True;
while i < PageMaxRow do
begin
i := i + 1;
Engine.ShowBand(Child1); //印空白表格end;
child1.visible := False;
end;