locked
Need to display RDLC page header only excel print preview but should not display in excel RRS feed

  • Question

  • User-1043180072 posted

    We are using RDLC version 10.0 in Visual Studio 2010.

    I tried to add Page Header and Footer on the exported Excel file and I want the header and footer to appear ONLY in print mode.

    The footer is showing correctly only in excel print mode. However, the header section is shown in both excel sheet itself and excel print mode.

    How to make the header section only shown on print mode only?

    Thank you.

    Thursday, November 7, 2013 5:21 PM

All replies

  • User-219472588 posted

    There is one way you can do this.

    You have to modify the way Print/Export button works. Since, you cannot modify the default event (may be it's possible by removing the event and then attaching the event you want), just hide the button from the reportviewer toolbar and then add new button there.

    You would find the toolstrip using 

    ToolStrip toolStrip = (ToolStrip)reportViewer.Controls.Find("toolStrip1", true)[0]

    And then you can add new toolstrip button obviously with event attached

    toolStrip.Items.Add(...)

    Now, since you have the complete control over the operation of Print button event, you can also render different report with header and footer you want.

    The way I find this is, you can always peep into reportviewer's controls to find the correct button to twick with.

    I hope this would give you into right direction.

    Cheers :-)

    Thursday, November 7, 2013 5:54 PM
  • User-1043180072 posted

    Sorry, i was not clear enough. Actually we export rdlc to excel directly without showing the rdlc pop up(as shown in this example  http://forums.asp.net/t/1556522.aspx)  and we want user to print directly from excel.

    We need to show Report name in Excel print preview only but not in Excel sheet itself.

    The wierd thing is Footer is not shown in excel sheet but shown when you see it in print preview which is what we want but Header is shown in both excel sheet and print preview.

    Why header and footer behave differently ?

    Friday, November 8, 2013 9:01 AM