RepeateStyle OnPage but first page different

Posted by: sascha.kraehenbuehl on 13 November 2019, 12:42 am EST

    • Post Options:
    • Link

    Posted 13 November 2019, 12:42 am EST

    Hi everyone

    We have a section report like a normal letter.

    On this report has “GroupHeader2” (header) attribute “RepeatStyle” “OnPage”. One letter could have 1 or more details. This means one letter could have one page minimum until many pages. BUT only on first page should be the address block. On page two and more until next letter should be the address block hide.

    At the moment it looks like if you activate RepeatStyle OnPage, then the group header will generate only once and not on every page again.

    Can you help us to fix it or to enplane how we can have same group header on every page with different elements on first page?

    You will find the example in attach.

    Many thanks for your time.

  • Posted 13 November 2019, 12:55 am EST

    files.zip

    Here are the files.

  • Posted 13 November 2019, 4:52 pm EST

    Hello,

    RepeatStyle.OnPage repeats the group header section with every new page.

    As per your report, it seems that your requirement is being met with the script you use. Please refer the attached gif showing how it appears at our end. Kindly inform if there’s some difference in the understanding of the requirement.

    The blank last page owes to the extra space from the PageHeader and GroupFooter1.

    You may also want to share the ActiveReports version that you use.

    Regards,

    Esha

    SectionReport_GroupHeader.zip

  • Posted 13 November 2019, 6:48 pm EST

    Hi Esha

    Thanks for your GIF. It is exactly what we need. But I did a fault.

    The problem is data-driven. The wrong second page is there, if second page has only one position. You can check the (new) example bottom. The position on second page is for letter “A1”. But in group header there is the address block with similar address from first page. On second page there shouldn’t be the address block.

    files.zip

    Thanks for your support

    All the best

  • Posted 14 November 2019, 10:10 pm EST

    Hello,

    Thanks for the modified report. To resolve the said issue, you can modify the script as:

    string LetterIDBefore = "";
    
    public void GroupHeader2_BeforePrint()
    {
    	if(LetterIDBefore == txt_Addressblock.Text)
    		txt_Addressblock.Visible = false;
    	else
    		txt_Addressblock.Visible = true;
    	}public void GroupHeader2_AfterPrint()
    {
    	LetterIDBefore = txt_Addressblock.Text;
    }
    

    OR

    int i = 0;
    public void GroupHeader2_Format()
    {
        TextBox1.Text = i.ToString();
        
        if(i==0)
            txt_Addressblock.Visible = true;
        else
            txt_Addressblock.Visible = false;
    }
    public void GroupHeader2_AfterPrint()
    {
        i = i + 1;
    }
    public void GroupFooter2_AfterPrint()
    {
        i = 0;
    }
    

    Hope this helps.

    Thanks,

    Esha

  • Posted 14 November 2019, 10:13 pm EST

    Hi Esha

    Your great! This is the solution.

    I never used before “AfterPrint” :slight_smile:

    Many thanks for your fast support.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels