Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
437 views
in Technique[技术] by (71.8m points)

reporting services - SSRS 2005 Set SimplePageHeaders on the report instead of the server?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...