Vs2005使用本地报表RDLC支持打印解决方法
下载本地报表 Microsoft Report Viewer 2008 SP1 Redistributable - 简体中文(http://www.microsoft.com/downloads/details.aspx?familyid=BB196D5D-76C2-4A0E-9458-267D22B6AAC6&displaylang=zh-cn)
下载语言包:Microsoft Report Viewer Redistributable 2008 SP1 语言包(http://www.microsoft.com/downloads/details.aspx?familyid=C1DF3B07-09D7-48CB-BB63-DF6D3C2F8141&displaylang=zh-cn)
开发前,发布网站之前修改Web.config文件中的ReportViewer控件版本为9.0之后再发布
要修改的地方如下:
<system.web>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
validate="false" />
</httpHandlers>
<compilation debug="true">
<assemblies>
<add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</buildProviders>
</compilation>
</system.web>
将VS2005为每个页面添加的标记注册说明去掉
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
在Web.config中添加统一注册控件(为了便于修改,由于开发和发布使用不同版本的控件,所以比较麻烦,统一更改可以减少些麻烦,但麻烦总是会有的)
<pages>
<controls>
<add tagPrefix="rsweb" namespace="Microsoft.Reporting.WebForms" assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</controls>
</pages>
另外发布的服务器上也必须安装本地报表控件9.0及语言包(这点比较麻烦,安装完之后一定要重启IIS服务,否则会无效)
注:本随笔为本人总结后发布,如果有雷同,纯属巧合
本人邮箱:freedomjim@gmail.com,如有疑问和交流欢迎发邮件过来一起讨论,一起成长,谢谢!
浙公网安备 33010602011771号