Turn of header for page 2

Posted by: kkluth on 18 September 2020, 3:59 am EST

    • Post Options:
    • Link

    Posted 18 September 2020, 3:59 am EST

    Using AR 10 and we have a document that page 1 needs to be on letterhead but not page 2 because it is a continuation of a letter. Page 3 would then have the letterhead back on it. Also would it be possible to have an entirely different letterhead image for page 4? Net help in knowing how to do these.

  • Posted 20 September 2020, 9:31 pm EST

    Hi,

    You can use the PageHeader/PageFooter Format event and inside set the visibility of the page header/footer section based on the PageNumber, as follows:```

    public void PageFooter_Format()

    {

    if(rpt.PageNumber%2==0)

    PageFooter.Visible = false;

    else

    PageFooter.Visible = true;

    }

    Do you want to modify the content of the existing elements/controls in section, want to add new controls etc or something else? Can you please specify?
    
    Regards,
  • Posted 21 September 2020, 1:12 am EST

    Thank you for the reply to the header/footer question. I will offer more context to what I am trying to do. The hope is to put a packet together within the report.

    Page 1 & 2 is a letter with header/footer being on page 1 but not page 2.

    Page 3 is the invoice which would then have the header/footer like page 1

    Page 4 is a policy with different page header/footer (this is currently not implemented as this is what my second question was regarding) We would swap out images and text.

    Each of these pages would be run for the number of records that are returned. If 50 records are returned we would have 200 total pages.

    With the above code, it doesn’t remove the header as I thought. It basically removed it from every other page.

    Should I be looking at subreports to do the various pages? If so I am unfamiliar with how to do that.

  • Posted 22 September 2020, 11:17 pm EST

    Hello,

    You can use the following script to achieve your requirement:

    
    public void PageHeader_Format()
    {
    	if(rpt.PageNumber % 4 == 0)
    	{
    
    		this.TextBox1.Text = "Picture";
    		this.Picture1.Image = Image.FromFile("D:\\Wyn_Data\\Query.jpg");
    		this.TextBox2.Text = "4";
    		
    	}
    	else if (rpt.PageNumber % 4 == 3)
    	{
    		this.PageHeader.Visible = true;
    		this.TextBox2.Text = "3";
    	}
    	else if (rpt.PageNumber % 4 == 2)
    	{
    		this.PageHeader.Visible = false;
    		this.TextBox2.Text = "2";
    	}
    	else 
    	{	this.PageHeader.Visible = true;
    		this.TextBox1.Text = "test";
    		this.Picture1.Image = Image.FromFile("D:\\Wyn_Data\\Download.jpg");
    		this.TextBox2.Text = "1";
    	}
    		
    }
    
    
    
    
    

    Hope it helps.

    Thanks,

    Mohit

  • Posted 23 September 2020, 7:26 am EST

    Your response has been very helpful. One last thing that I need help with. With the header, we are using SubReports, and I need a different one on page 4. Footers seem to all be working just fine. Page 4 doesn’t display any header. Below is the code.

    Public Sub PageHeader1_Format()
    	If rpt.PageNumber Mod 4 = 0 Then
    		Me.SubReport3.Visible = True 'Letterhead_Primary_Top
    		Me.Subreport1.Visible = False 'Letterhead_ASI_Top
    	ElseIf rpt.PageNumber Mod 4 = 3 Then
    		Me.PageHeader1.Visible = True
    		Me.SubReport3.Visible = False 'Letterhead_Primary_Top
    		Me.Subreport1.Visible = True 'Letterhead_ASI_Top
    	ElseIf rpt.PageNumber Mod 4 = 2 Then
    		Me.PageHeader1.Visible = False
    		Me.SubReport3.Visible = False 'Letterhead_Primary_Top
    		Me.Subreport1.Visible = False 'Letterhead_ASI_Top
    	Else
    		Me.PageHeader1.Visible = True
    		Me.SubReport3.Visible = False 'Letterhead_Primary_Top
    		Me.Subreport1.Visible = True 'Letterhead_ASI_Top
    	End If
    End Sub
    
    Public Sub PageFooter1_Format()
    	If rpt.PageNumber Mod 4 = 0 Then
    		Me._Date.Visible = False
    		Me.line3.Visible = True
    		Me.Text16.Visible = True
    		Me.Text17.Visible = True
    		Me.Text18.Visible = True
    		Me.Picture3.Visible = True
    		Me.SubReport2.Visible = False
    	ElseIf rpt.PageNumber Mod 4 = 3 Then
    		Me._Date.Visible = True
    		Me.line3.Visible = False
    		Me.Text16.Visible = False
    		Me.Text17.Visible = False
    		Me.Text18.Visible = False
    		Me.Picture3.Visible = False
    		Me.PageFooter1.Visible = True
    		Me.SubReport2.Visible = True
    	ElseIf rpt.PageNumber Mod 4 = 2 Then
    		Me._Date.Visible = False
    		Me.PageFooter1.Visible = False
    		Me.line3.Visible = False
    		Me.Text16.Visible = False
    		Me.Text17.Visible = False
    		Me.Text18.Visible = False
    		Me.Picture3.Visible = False
    	Else
    		Me._Date.Visible = True
    		Me.PageFooter1.Visible = True
    		Me.SubReport2.Visible = True
    		Me.line3.Visible = False
    		Me.Text16.Visible = False
    		Me.Text17.Visible = False
    		Me.Text18.Visible = False
    		Me.Picture3.Visible = False
    	End If
    End Sub
    
  • Posted 23 September 2020, 6:41 pm EST

    Hello,

    Can you try after after having the One SubReport control instead of 2. Just assign the different subreport to the Report property of SubReport control as per condition. It will improve your performance also.

    Also, if issue still exits, could you please share the demo reports with dummy db so that I can able to replicate the issue at my end.

    Thanks,

    Mohit

Need extra support?

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

Learn More

Forum Channels