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

How to set the label caption on the report

edited April 2005 in General
I put labels on the report header which is to be set at run time or before
print.
In Delphi, I tried

with ppReport1 do
begin
lblCompanyName.Caption := 'XYZ Company';
Print;
end;

This 'XYZ Company' is read from ini file, not from database.
It does not set the caption of the label when the report is shown in
preview. I just showed as lblCompanyName.

Comments

  • edited April 2005
    > with ppReport1 do

    it should work, you must be doing something wrong.

    Note that lblCompanyName is not a property of ppReport1 so you don't have to
    apply the 'with' statement to it.

    so you can do it in 2 lines:

    lblCompanyName.Caption := ...
    ppReport1.Print

    so the question is why isn't it working--some debugging. Check the
    following:

    1) the class name of lblCompanyName
    2) the value of lblCompany.Caption in the reports' BeforePrint event.
    3) check the band of the label is correct.


    Ed Dressel
    Team DM
  • edited April 2005
    What do you meant by this ?
  • edited April 2005
    So how do I refer to this lblCompany from Delphi calling program ?

    to
  • edited April 2005
    it's owned by the datamodule/form, not the report.

    --
    Ed Dressel
    Team DM
  • edited April 2005
    check the lblCompanyName.Band.ClassName property, that it is the detail
    band.

    --
    Ed Dressel
    Team DM
This discussion has been closed.