Conditional page header

I have a report which is made up of multiple sub reports. I want to print a second line on my page header for some of the subreports but not for others. Is there a way to do this in the code. 

Comments

  • Hello!

    To ensure that the second line in the PageHeader is printed only for selected subreports/sections:

    Place the second header line in a ChildBand under the PageHeaderBand (or in a TextObject inside the PageHeader).

    Keep in mind an important detail regarding the rendering order: when a page break occurs, the engine renders the PageHeader at the start of the new page. Therefore, toggle the flag/visibility before the start of the new block on the new page (or place sections with different headers on separate ReportPages, or call Engine.StartNewPage() after toggling the flag in AfterPrint).

    bool showSecondLine = true;
    private void ChildHeader_BeforePrint(object sender, EventArgs e) => ((ChildBand)sender).Visible = showSecondLine;
    
This discussion has been closed.