[英]Adjust Object Positions/Dimensions in FastReport 5
I need to move around some memo objects and adjust the height of a band while the report is being generated. 在生成报告时,我需要在一些备忘录对象周围移动并调整乐队的高度。 I added the following to the script:
我在脚本中添加了以下内容:
procedure MasterDataOnBeforePrint(Sender: TfrxComponent);
begin
if (DRID = <TRAN_DETAIL."REFERENCEID">) then
begin
txChargeDate.Top := 0;
txChargeDesc.Top := 0;
txChargeQuant.Top := 0;
txChargeAmt.Top := 0;
txDRInfo.Visible := false;
txDRDesc.Visible := false;
MasterData.Height := 0.25;
end
else
begin
MasterData.Height := 0.65;
txChargeDate.Top := 0.4;
txChargeDesc.Top := 0.4;
txChargeQuant.Top := 0.4;
txChargeAmt.Top := 0.4;
txDRInfo.Visible := true;
txDRDesc.Visible := true;
end;
DRID := <TRAN_DETAIL."REFERENCEID">;
end;
Basically, if the current line item has the same ReferenceID as the previous line item, then I don't want txDRInfo and txDRDesc to print. 基本上,如果当前订单项与上一个订单项具有相同的ReferenceID,则我不希望打印txDRInfo和txDRDesc。 I also don't want a big space to show up where they would have been.
我也不希望有很大的空间来显示它们的原位。 So, I check if the reference ID has changed and move the items around and hide the text that isn't to be printed.
因此,我检查参考ID是否已更改,并四处移动项目并隐藏不打印的文本。
The problem with this is that although this is in the BeforePrint event, any changes I make to position or size affect ALL line items and not just the one being looked at by the event. 这样做的问题是,尽管这是在BeforePrint事件中,但我对位置或大小所做的任何更改都会影响所有订单项,而不仅是该事件正在查看的订单项。
Is there a way around this using Delphi 2007 and FastReport VCL 5? 使用Delphi 2007和FastReport VCL 5可以解决此问题吗?
I figured out a better way to do this. 我想出了一种更好的方法。 I discovered that if a child band is made invisible, you can still have any children it has print.
我发现,如果使子带不可见,您仍然可以让任何带子的孩子打印。 So, I took everything out of the Master Data band and moved them in to 2 child bands:
因此,我将所有内容从“主数据”乐队中删除,并将其移至两个子乐队中:
Master Band (Height = 0)
Child Band 1 with stuff to hide; PrintChildIfInvisible = true
Child Band 2 with stuff to always show
Then in Child Band 1's before print I just check if it should be made invisible or not. 然后在打印之前的“儿童乐队1”中,我只是检查是否应使其不可见。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.