Click here to Skip to main content
15,896,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a RDLC report with header. It works fine and export to excel generates excel file with data as well as header. I can not remove the header as it is required in report viewer but while exporting, the header data should not load and excel file should start with table column header not report header.

What I have tried:

I tried to check header properties, If I unchecked the "Print on first page" the header is removed from Report viewer. But I want the header to be removed only while exporting. Any suggestion on this will be helpful. Thanks
Posted
Updated 3-Mar-17 6:07am

1 solution

If you're using SQL 2008 R2 or later, it's easy to hide elements when the report is exported:
Globals!RenderFormat aka Renderer Dependent Report Layout – Robert Bruckner's Reporting Services & Power View Blog[^]

If you're using 2012 or later, you'll also need to check for a render format of "EXCELOPENXML".

To hide an element when you're exporting to Excel, set its "hidden" property to the expression:
=Globals!RenderFormat.IsInteractive = "EXCEL" Or Globals!RenderFormat.IsInteractive = "EXCELOPENXML"


If you're using SQL 2005 or 2008, there doesn't seem to be a solution.
 
Share this answer
 
Comments
bhupendra singh rathore 6-Mar-17 6:50am    
I am using Visual Studio 2010 RDLC report and I think it does not have this feature. I tried the above expression and it shows error for the keyword RenderFormat. Thanks for your response :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900