Prevent empty lines

edited 1:35AM in FastReport 4.0
Hi there,

I have built a report in order to generate an overview of all Customers and their Invoices.

The report contains a GroupHeader band (including the information of the Customers such as name, address, phone), and a MasterData band (including invoice number, total amount, etc.).

So far so good. All data is visible when I preview the report.

However, when a Customer does not have any Invoices yet, the MasterData band generates an empty line. I do not want these empty lines. How can I prevent empty lines in this case?

Thank you for your assistance.

Note: I am using FastReport 4.8.7 and Delphi 7.

Kind Regards,
Stefan

Comments

  • gpigpi
    edited 1:35AM
    See a solution from Mike.pl
    procedure  SuppressBlankLines( MemoView :TfrxMemoView);
    var  i,last :int;
    begin
      Last := 0;
      with TfrxMemoView(MemoView).Memo do
      while Last >= 0 do begin
        Last := -1;
        // find last empty line
        for i:=0 to Count - 1 do if Strings[i] = '' then Last := i;
        // and delete it
        if Last >= 0 then Delete(Last);
      end;
    end;
    
    procedure Memo2OnBeforePrint(Sender: TfrxComponent);
    begin
      SuppressBlankLines( TfrxMemoView(Sender));
    end;
    
  • edited 1:35AM
    I try to guess what your select statement could be. It must contain at least company name and invoice no. I guess this data comes from two tables, let's say customers and invoices. I wolud write

    select c.name, i.number
    from customers c join invoices i
    order by c.name, i.number


    And when there is NO invoice for a certain customer you will have no row for this customer and no group header.
    Or maybe you need to print GroupHeader but with no MasterData band?

    So which of the situations do you really have? The one Gpi described or mine above?
    Write a bit more about your issue.

    Mick

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.