Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Column Heading Disappears

edited November 2001 in General
Hi,

I have a report that varies in the data printed. It makes use of multiple
columns if the data will fit. My problems is if I print multiple times and
one of the prior runs was single column (no col head) and then print a
report with 2 or more columns the col heading no longer print. I've tried
setting both column header and pplabel component to visible.

Put another way, how do you display col headers after printing a report with
a single column?

RB 5.56 Delphi 5 Ent

TIA, John Panagia

Comments

  • edited November 2001
    Check the height setting on the column header. You may have to set it
    dynamically since you are creating the columns dynamically.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited November 2001
    Hi Jim,

    I've tried setting height of columnheader band to dynamic, doesn't help.
    I've also played with all of the various visible and height properties. Just
    to be clear, the problem only exists if I first set columns to 1 and then go
    back to 2 or more. Anymore ideas?


  • edited November 2001
    I wasn't able to reproduce the problem. The following code works in my test
    project. Perhaps the components in the column header band need to be
    reassigned to that band by setting their Band property?

    procedure TForm1.Button1Click(Sender: TObject);
    begin

    PrintReport(2);

    PrintReport(1);

    PrintReport(2);

    end;

    procedure TForm1.PrintReport(aColumnCount: Integer);
    begin

    CreateColumns(ppReport1, aColumnCount);

    ppReport1.Print;

    end;

    procedure TForm1.CreateColumns(aReport: TppReport; aColumnCount: Integer);
    var
    lLabel: TppLabel;
    begin

    aReport.Columns := aColumnCount;

    aReport.ColumnHeaderBand.Height := 0.25;

    lLabel := TppLabel.Create(nil);
    lLabel.Band := aReport.ColumnHeaderBand;
    lLabel.AutoSize := True;
    lLabel.Caption := 'ColumnHeader';
    lLabel.Visible := True;

    end;


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited November 2001
    Jim,
    I was not calling my routine that adjusted the column related properties.
    Now the column heading have reappeared. The only remaining problem is when
    there is one column RB doesn't display the column header band. Right now I
    have label component in the page heading band and hide/show it depending on
    number columns. Is there a better way? If not, thanks for all your help.

    John Panagia

  • edited December 2001
    Column headers and footer aren't supported in a single column report. You
    will need to create a group and use the group headers and group footers for
    this case. There is an example of dynamically creating a group:
    http://www.digital-metaphors.com/tips/DynamicReportCreation.zip


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.