Reputation: 757
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. 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.
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.
Is there a way around this using Delphi 2007 and FastReport VCL 5?
Upvotes: 0
Views: 2427
Reputation: 757
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.
Upvotes: 1