FastReport中国社区FastReport联系电话 联系电话:023-68661681

FastReport可以实现连续打印吗?

来源:   发布时间:2016-08-08   浏览:7835次

很多人认为FastReport不能实现连续打印,以为只能通过自己写函数调用打印函数来实现连续打印,实际上,FastReport可以轻易的实现连续打印,同时,实现时又是非常简单,你甚至可以在你的程序的打印设置中简单的让客户选择是否连续打印,其它都可以保持不变。

function PelsTomm(Pels:Extended):Extended;
begin
Result:=Pels/Screen.PixelsPerInch*25.4;
end;

procedure PrintSerial(Frx:TFrxReport;SequencePage:Byte=0);
var
P:TfrxReportPage;
R,R1:Extended;
begin

{必须是二遍报表,否则无法计算总页数。下面的方法只适用于没有页脚的情况,因为如果有页脚的话FreeSpace就始终为0了。可以用报表脚来代替。因为是连续打印,也可以看作只有一页,报表脚也就相当于页脚了}

if not Frx.Engine.DoublePass then Exit;
//SequencePage指要连续打印的页面,普通报表就是0
P:=TfrxReportPage(Frx.Pages[SequencePage]);
R1:=P.TopMargin+P.BottomMargin;
while Frx.PrepareReport do
begin
if (Frx.Engine.TotalPages<=1) then Break;
R:=Pelstomm(Frx.Engine.TotalPages*Frx.Engine.PageHeight-
Frx.Engine.FreeSpace)+R1;
P:=TfrxReportPage(Frx.Pages[SequencePage]);
P.PaperHeight:=R;
end;

{必须用上面的循环代码来得到准确的空白区域,不能用通过计算总页数减去各页的页边距的方法来获得空白区域,因为如果碰到一条记录过宽的情况导致换页,就不准确了。}

R:=Pelstomm(Frx.Engine.TotalPages*Frx.Engine.PageHeight-
Frx.Engine.FreeSpace)+R1;
P:=TfrxReportPage(Frx.Pages[SequencePage]);
P.PaperHeight:=R;
end;

本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:FastReport控件中文网 [https://www.fastreportcn.com/]
本文地址:https://www.fastreportcn.com/post/1013.html

联系我们
  • 重庆总部 023-68661681
购买
  • sales@evget.com
合作
  • business@evget.com


在线
客服
微信
QQ 电话
023-68661681
返回
顶部