Check if new page starting

Is there a way to check if a sub report is printing on a new page.

Comments

  • Hello!

    Yes, you can determine in the script whether a subreport has moved to a new page by comparing Engine.CurPage (and, if necessary, Engine.CurY) in the BeforePrint and AfterPrint events:

    private int prevPage = -1;
    private void Subreport1_BeforePrint(object sender, EventArgs e)
    {
    prevPage = Engine.CurPage;
    }
    
    private void FirstBandInSubreport_BeforePrint(object sender, EventArgs e)
    {
    bool startedOnNewPage = (Engine.CurPage != prevPage) || (Engine.CurY <= Engine.PageHeaderHeight + 1f);
    }
    
This discussion has been closed.