Creating bands in code
The ppReport has only a DetailBand and I want to create header and
footer in runtime.
I'm getting an Access Violation on the third line, why?
ppReport.DefaultBands := [btHeader, btDetail, btFooter];
ppReport.CreateDefaultBands;
ppReport.HeaderBand.PrintHeight := phDynamic;
Thanks!
--
Erick Sasse
footer in runtime.
I'm getting an Access Violation on the third line, why?
ppReport.DefaultBands := [btHeader, btDetail, btFooter];
ppReport.CreateDefaultBands;
ppReport.HeaderBand.PrintHeight := phDynamic;
Thanks!
--
Erick Sasse
This discussion has been closed.
Comments
Once you have created and edited a report with existing bands, you cannot
use the CreateDefaultBands to simply add new bands on top of it. You will
need to create the Header and Footer band objects separately and assign them
to the current report using the Band.Report property.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Ok Nico, so I did it like this:
if ppReport.HeaderBand = nil then
with TppHeaderBand.Create(ppReport) do
Report := ppReport;
Is this the best way? Do I have to set Report property even if I create
using the report as parent?
--
Erick Sasse
This is correct. When you pass ppReport as the Band's owner in your Create
call, you are not setting the Band's parent. The owner of the band should
either be the form, datamodule or nil. If you do not set the Band.Report
property, the band will not show up.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com