Exporting from SSRS to Excel with no headers [closed]

流过昼夜 提交于 2019-11-27 06:41:05

问题


Is there a way to export to excel from an SSRS report so that the header that displays on the first page of the report is omitted only in the excel export? Currently, it adds a frozen frame to the top of the worksheet.


回答1:


Update

Also see my answer about how to add a new Excel rendering option that strips the header

Original answer follows:

If you can get the URL for the Excel output (some versions of SSRS leave the browser displaying it), you can append some code to the end:

&rc:SimplePageHeaders=True

This removes the header. This is a manual hack that comes in handy, or you can add it to the rsreportserver.config file

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

Failing that there's Aspose.Cells or OfficeWriter - I haven't used either product, I just know of their existence.

Or for the really brave, you can create your own custom renderer




回答2:


Unfortunately Reporting Services 2000, 2005, and 2008 do not have a way to alter the results of the report based on the render-method selected by the user. This means your only alternative is to provide a parameter to the report that will hide or show the header.

If users are accessing reports via Report Manager, then this is generally not a reasonable resolution and there's no good resolution to the problem. If you are running subscriptions that render the report to Excel and delivering the reports either via email, file share, or SharePoint, then this method is adequate for resolving the problem.

I would be willing to pay a small amount of money for a custom render-method extension if someone has coded a solution to this. But to-date, I haven't seen a set of code that achieves this purpose.




回答3:


A couple of notes on my experience on applying the config mod in Chris's answer:

  1. If your report was generated by the report wizard, note that the wizard places the "header" text of the report in the body, not the header. So, make sure your header is actually in a header section.

  2. I found that using the VS 2008 report preview would not show the change on export. However, when I went back to browse my web page (which contains a ReportViewer control), I hit Ctrl+F5 and it then exported as expected.

  3. Don't forget to re-deploy your report.



来源:https://stackoverflow.com/questions/521719/exporting-from-ssrs-to-excel-with-no-headers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!