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

region on report design is nil at runtime

edited January 2014 in General
I have a fairly simple report design in which most of the content is
dynamic. In the header band, I have placed a region with no other
content--the rest is created dynamically. When I run the report, and
try to place TppLabels in the region, it fails because the region is
nil.

No code touches the region until I try to create content. What am I
missing?

Thanks,

Bill

Comments

  • edited January 2014
    Hi Bill,

    There is no reason the region should be nil unless you are dynamically
    creating or freeing it. I did a simple test following your
    specifications and was able to successfully add a label created in code
    to an empty region in the header band. Below is my code.

    procedure TForm1.Button1Click(Sender: TObject);
    var
    lLabel: TppLabel;
    begin

    lLabel := TppLabel.Create(Self);
    lLabel.Height := 1;
    lLabel.Width := 1;
    lLabel.Caption := 'My Label';
    lLabel.Region := ppRegion1;

    ppReport1.Print;

    end;

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited January 2014
    Nico Cizik (Digital Metaphors) wrote:


    Nico, I understand, but I have no code freeing it. The pattern in the
    report design and its code are parallel to the patter of other reports,
    with the exception that in other reports, groups are used in many
    places where it does not seem necessary. In this report I have (as yet)
    created no groups.

    I have taken to creating the region dynamically, which at least allows
    me to proceed.

    However, while I see it on my preview, along with the ppLabels I put in
    it, when I print, the region and labels are absent. I have never seen a
    preview before which did not print everything in it.

    Bill
This discussion has been closed.