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

Created Headerband in Code NOT visible

edited March 2014 in General
Hello,
I try to create a subreport in code:

/lSubReport := TppSubReport.Create(Self);//
//
// { add to the main report's detail band }//
// lSubReport.Band := ppRepGrid.DetailBand;//
//
// { create the child report (parameters: main report) }//
// lSubReport.CreateReport(ppRepGrid);//
//
// lChldReport := TppChildReport(lSubReport.Report);//
// lChldReport.Units:=utScreenPixels;//
//
//
// {create header, detail, footer bands }//
// lChldReport.DefaultBands:=[btHeader, btDetail, btFooter];//
// { create the default set of bands }//
// lChldReport.CreateDefaultBands;//

// lChldReport.HeaderBand.Height:=50;//
// lChldReport.HeaderBand//.Visible:=True;

lChldReport.DetailBand.Height:=20;//
//
//
// { assign a datapipeline }//
// lChldReport.DataPipeline := plGrid;//
//
//
// lLabel := TppLabel.Create(Self);//
// lLabel.Band := lChldReport.HeaderBand;//
// lLabel.Caption := 'Barcode';//
// lLabel.Font.Name := 'Times New Roman';//
// lLabel.Font.Size := 24;//
//
// lDBText := TppDBText.Create(Self);//
// lDBText.Band := lChldReport.DetailBand;//
// lDBText.DataPipeline := plGrid;//
// lDBText.DataField := 'Barcode';//
//
// lDBText.Color := clYellow;//
// lDBText.Font.Name := 'Times New Roman';//
// lDBText.Font.Size := 12;//
//
// ppRepGrid.Print;/

In the report only the Detailband is visible. When I build the child
report with a Titleband (i.s.o Headerband), all goes perfect. But I
want a Headerband (on every page).
What am I doing wrong?

Thanks
Bas

Comments

  • edited March 2014
    Hi Bas,

    For Child style subreports the header and footer bands are not
    supported. Section and Fixed style subreports do support header and
    footer bands. See the following tech tip.

    ------------------------------------------------------------------
    Tech Tip: Subreport header/footer bands do not print for
    Child type subreports.
    ------------------------------------------------------------------

    For a subreport set to pbChild, the header/footer are not supported.
    A child type subreport prints on its parent's page space and
    therefore behaves more like a memo.

    Options:

    1. Use Title/Summary band.

    2. Use GroupHeader/GroupFooter. If you need to repeat the header
    when a page breaks then then you can create a group and
    set Group.ReprintOnSubsequentPage to True.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.