How to modify the text before preview in my report

edited 11:53PM in FastReport 3.0
hello,
i want to modify the text shown which from a database before preview,such as if the total num is not null then i will show "total num:....",if the total num is null,then the text object will empty,all these will be done before the preview?
i can do something like these before print,but not preview,who can help me?

Comments

  • ShivanShivan Germany
    edited 11:53PM
    I have the same problem. I solved it more or less good with scripting by setting the height of the Memo:

    OnBeforePrint of the Memo:
    procedure memLine2OnBeforePrint(Sender: TfrxComponent);
    begin
           if <Rechnungsposition."GuestName"> = '' then
           begin
             memLine2.Height := 0;
           end else
           begin
             memLine2.Height := 0.50;
           end;
    end;
    

    It's not very nice, but it works... maybe there's a better solution?
  • edited 11:53PM
    thanks.but what i ask if before the preview,not before the print?
    whether before preview is the same as the before print?i do not think so?
    thanks again.
  • ShivanShivan Germany
    edited 11:53PM
    if you're talking about the print preview, then yes, it won't be "visible"...

    Btw. I think there's another solution, too.
    in the OnGetData event --> set the component to invisible. (memo.visible := false)
    But I didn't try this yet.
  • foxfox
    edited 11:53PM
    Maybe this helps ...
    {
      This example shows a way to hide Barcode after userselection in main programm.
      I have two TfrxMasterData, one assigned to a not used subreport.
      So I can change the parent of TfrxBarCodeView like following ... 
    }
    procedure TrepList.BarcodeOn(ShowIt:boolean);
    var bc: TfrxBarCodeView;
        md: TfrxMasterData;
    begin
      bc:=frxReport1.FindObject('Barcode1') as TfrxBarCodeView;  
      if bc<>nil 
      then begin
        if ShowIt 
        then begin
          md:=frxReport1.FindObject('MyUsedMaster') as TfrxMasterData;
          bc.parent:=md
        end
        else begin
          md:=frxReport1.FindObject('MyHiddenMaster') as TfrxMasterData;
          bc.parent:=md
        end
      end
    end;
    

Leave a Comment