Getting the height of the detail band
Hi,
I've got a report with a fixed-size header, one detail band (with two
dynamic subreports) and a summary where the user can provide their own
text and an image. I want to size the image to take up the remaining space
on the page, depending on how many records are shown in the subreports of
the detail band and how much text the user enters for the summary.
Using RAP and pass-through functions I have managed to get the height of
the page and to calculate the height of the text. I can also subtract the
height of the header. However, when I try to get the Detail.Height in any
of the Summary's events it always returns the designed height, not the
actual height I was expecting (in the second pass), so the image turns out
a bit too large.
Is it somehow possible to get the height of the detail band (or is there
an alternative solution to this problem), preferably without printing to a
dummy device?
Thanks in advance,
Mark van Renswoude
UnameIT
I've got a report with a fixed-size header, one detail band (with two
dynamic subreports) and a summary where the user can provide their own
text and an image. I want to size the image to take up the remaining space
on the page, depending on how many records are shown in the subreports of
the detail band and how much text the user enters for the summary.
Using RAP and pass-through functions I have managed to get the height of
the page and to calculate the height of the text. I can also subtract the
height of the header. However, when I try to get the Detail.Height in any
of the Summary's events it always returns the designed height, not the
actual height I was expecting (in the second pass), so the image turns out
a bit too large.
Is it somehow possible to get the height of the detail band (or is there
an alternative solution to this problem), preferably without printing to a
dummy device?
Thanks in advance,
Mark van Renswoude
UnameIT
This discussion has been closed.
Comments
You will want to use the Report.Engine.PrintPosRect.Top property to get the
position on the page after the detail band generates. Subtracting this from
the Engine.PageBottom should give you the remaining space available after
the detail band prints.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
thanks for the response, it pointed me in the right direction. After a bit
of experimenting, here's my solution:
In the AfterPrint event of the detail band (as opposed to the
AfterGenerate, where the PrintPosRect.Top hasn't been updated yet) I check
for the FirstPass and call a pass-through function to get the
Report.Engine.PrintPosRect.Top and store it in a report global variable
(DetailEnd: Single).
In the SecondPass BeforeGenerate of the summary band I use another
pass-through function to get the Report.Engine.PageBottom, from which it
seems I have to subtract Report.PrinterSetup.MarginBottom to get a proper
result. From that I subtract the DetailEnd to get the remaining available
space and divide it among the image and text.
Regards,
Mark
On Fri, 07 Sep 2007 16:58:12 +0200, Nico Cizik (Digital Metaphors)