How To…Calc a Dynamic Detail Height

Question

“How do I calculate the height of each dynamic detail band’s height as the report is generating?”

Solution

Use the DetailBand.BeforeGenerate to find the top of each band and the DetailBand.AfterPrint event to find the bottom and calculate the height.  Do this during the first pass of the report to find each height before the report actually prints.

Download: DynamicDetailHeight.zip

Sample Delphi code: