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

Resize detail band

edited September 2006 in General
Hi,

I need to dynamically resize the detail band. There will be one record in
my report that will require a label and a line to be displayed. On all of
the other records, I want to make the height of the detail band less to
take up the extra white space from the line and lable (which aren't
displayed on all but one record).

I have the following code, and it works great if the report is only run
once, unfortunately, it seems that once I resize the detail band, it can't
be resized again. Therefore, if the report is run a second time with the
exact same data, all of the records have the smaller detail band height,
including the one that needs to display the label and line. Any ideas?

If dm.tblOutput.FieldByName('Unique').AsInteger = firstNonZero Then
Begin

lnOptional.Visible := True;
lblOptionalPricing.Visible := True;
ppDetailBand1.Height := 0.6979;
End
Else
Begin
lnOptional.Visible := False;
lblOptionalPricing.Visible := False;
If dm.tblOutput.FieldByName('Unique').AsInteger > firstNonZero Then
ppDetailBand1.Height := 0.5000;
End;



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited September 2006
    Hi,

    Instead of trying to manually resize the detail band, try setting its
    PrintHeight to phDynamic and simply toggling the visibility of the label and
    line in code. If the band is a dynamic height, then it will snap to the
    correct size based on the bottom-most component.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2006
    To handle the situation where a static component (such as a Label or DBText)
    is above other static components, you will need to use regions. For
    instance, if you place a region with Stretch set to True at the top of the
    detail band with your label inside, then place another region with all your
    other detail components inside below and have it ShiftRelativeTo the first
    region, when you set the visibility of the label at the top to False, the
    second region will shift up and fill the empty space.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2006
    Ok,

    The label that I was turning the visibility on/off is at the top of the
    detail band. Is that why it's not resizing?





    --- posted by geoForum on http://delphi.newswhat.com
  • edited September 2006
    Ok,

    I tried moving the label and line that will be toggled on/off to the
    bottom of the band. Unfortunately, this doesn't work at all. On records
    that display the label/line, it places them on top of a rich text control
    that is also in the detail band! So it looks totally muddled. How can
    this be resolved? I have the detail band set to dynamic.




    --- posted by geoForum on http://delphi.newswhat.com
  • edited September 2006
    Using regions worked perfectly! Thanks for the help!





    --- posted by geoForum on http://delphi.newswhat.com
This discussion has been closed.