C# 打印按钮在 ReportViewer 中不可见
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15550234/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Print button not visible in ReportViewer
提问by Answer_42
I have a report viewer that shows a remotereport. But when the report is loaded i can't see the print,refresh buttons. The same thing happens on the server PC when i try to check my reports in the report manager. (Used Chrome,Firefox)
我有一个显示远程报告的报告查看器。但是当报告加载时,我看不到打印、刷新按钮。当我尝试在报告管理器中检查我的报告时,同样的事情发生在服务器 PC 上。(使用 Chrome、Firefox)
Here is a screenshot the toolbar where the buttons should be.
这是按钮应该在的工具栏的屏幕截图。
This my reportviewer starting tag code. (The buttons are all "true" to be visible)
这是我的 reportviewer 起始标记代码。(按钮都是“真”可见)
<rsweb:ReportViewer ID="ReportViewer1" runat="server" CssClass="reportviewer" Font-Names="Verdana" BorderColor="Black" ShowBackButton="true" ShowPrintButton="true" ShowRefreshButton="true"
BorderStyle="None" Font-Size="8pt" InteractiveDeviceInfos="(Collection)" WaitMessageFont-Names="Verdana" AsyncRendering="false" SizeToReportContent="true"
WaitMessageFont-Size="14pt" Height="1050px" Width="900px" ProcessingMode="Remote">
I have tried to fix this problem by installing ReportViewer Redistributable pack 2010in both my development PC and the server. I tested both local and remote reports but it's the same on both cases.
我试图通过在我的开发 PC 和服务器中安装ReportViewer Redistributable pack 2010来解决这个问题。我测试了本地和远程报告,但这两种情况都是一样的。
How can i fix it?
我该如何解决?
Environment: SQL Server 2012 64 bit; IDE: VISUAL STUDIO 2010;
环境:SQL Server 2012 64位;IDE:VISUAL STUDIO 2010;
NOTE 1 : The refresh button is visible when i remove all of the css references. (Thanx @DJ KRAZE for pointing that)
注意 1:当我删除所有 css 引用时,刷新按钮是可见的。(感谢@DJ KRAZE 指出这一点)
NOTE 2 : Just checked the new CSS rules and the print button is visible in IE.
注意 2:刚刚检查了新的 CSS 规则并且打印按钮在 IE 中可见。
采纳答案by Answer_42
Hereis a class in Brian Hartman's Report Viewer Blogthat can print both local and server reports.
这是 Brian Hartman 的 Report Viewer Blog中的一个类,它可以打印本地和服务器报告。
Just create a button or a image button and use it like this in the onclick method to print from any browser.
只需创建一个按钮或图像按钮并在 onclick 方法中像这样使用它即可从任何浏览器进行打印。
ReportPrintDocument rp = new ReportPrintDocument(ReportViewer1.ServerReport);
rp.Print();
回答by Apollo
Print button is hidden in any browser that is not IE because ReportViewer uses ActiveX for client printing which means no other browser other than IE can handle it.
打印按钮隐藏在任何非 IE 浏览器中,因为 ReportViewer 使用 ActiveX 进行客户端打印,这意味着除 IE 之外没有其他浏览器可以处理它。