SSRS 2005 Set SimplePageHeaders on the report instead of the server?

Adam picture Adam · Jun 15, 2010 · Viewed 12.2k times · Source

I have one report that does not export to excel friendly from SSRS 2005. I know I can use


<Render>
    <Extension Name="EXCEL" Type="Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering">
        <Configuration>
            <DeviceInfo>
                <SimplePageHeaders>True</SimplePageHeaders>
            </DeviceInfo>
        </Configuration>
    </Extension>
</Render>

in the rsreportserver.config, but I am not the only person with reports on this machine. I also found that you can pass

&rc:SimplePageHeaders=True
in the url to export the report programatically.

I tried adding the &rc:SimplePageHeaders=True to the end of the url when navigating to the report manager, but when I select excel from the dropdown and click export the headers are still exported. I even tried setting the rc:Command=Render and rc:Format=EXCEL in the url too without any luck.

Is there a way to do what I am trying to do?

note: I am wanting to render the report on the built in report manager and use the build in export to excel dropdown, not in an app or website.

Answer

Chris Latta picture Chris Latta · Jun 17, 2010

Instead of overriding the existing Excel renderer, what you want to do is supply another renderer that strips out the headers and include this in the list of renderers available to the export menu. You almost have the solution - instead of modifying the current Excel renderer you want to supply another one. There are a couple of tricks here:

  • You must give this renderer a name that is different to the current Excel renderer which has Name="EXCEL" on my system, otherwise you will only see one Excel renderer
  • The displayed name of the renderer will not be the name you called it above, but will simply be Excel as that is the display name supplied by the renderer, so you will see two options called Excel and you won't know which is the one without page headers.
  • Consequently you must override the name
  • When you override the name, you must specify the language that you are overriding it for. The language value that you set must be valid for the report server computer. For example, if the report server is running on a French operating system, you should specify "fr-FR" as the attribute value. I'm using "en-AU" as I am Australian, you would use "en-US" if you are in USA.

Thus, under the current EXCEL renderer (don't replace the existing one) in <Render> section of rsreportserver.config, you would insert something like:

<Extension Name="EXCEL (No Header)" Type="Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering">
    <OverrideNames>
        <Name Language="en-AU">Excel (No Header)</Name>
    </OverrideNames>
    <Configuration> 
        <DeviceInfo>
            <SimplePageHeaders>True</SimplePageHeaders> 
        </DeviceInfo> 
    </Configuration> 
</Extension>

This will give you two Excel options on the Reporting Services export menu: Excel and Excel (No Header)

Don't forget to change the language attribute in <OverrideNames> to the language on your report server or both options will simply be called Excel