如果想使用户能够打印在 Web 上访问的整个多页报表,您有下列选项:
1、使用Web 窗体 Viewer 工具栏上的“打印”按钮将报表导出为 PDF。
2、使用Web 窗体 Viewer 工具栏上的“导出”按钮,导出报表为可以由客户端的现有应用程序打印的格式。
3、使用PrintToPrinter 方法从服务器打印报表。
4、将报表作为一个连续的页提供以通过 Internet Explorer 浏览器在客户端启用打印。
如果用户无权访问打印导出的报表所需的应用程序,并且服务器端打印存在安全性或访问权限问题,您可能需要使用户能够从他们的浏览器打印报表。此方法将整个报表作为一个连续的页显示在 Web 窗体 Viewer 控件中,因而能够使用浏览器的打印功能。
在应用程序中,可以在现有 Web 窗体 Viewer 旁边添加一个按钮,该按钮可以将客户端重定向到新的、在浏览器中将整个报表显示为一个连续页的 Web 窗体 Viewer。可以对第二个窗体上的查看器进行格式化,以便禁用组树和工具栏,并将查看器的 SeparatePages 属性设置为 False。
注意 这种打印方法有一个局限,即无法控制页眉、页脚和分页符的定位。
crReportDocument = New Income_Statement()
CrystalReportViewer1.ReportSource = crReportDocument
CrystalReportViewer1.SeparatePages = False
CrystalReportViewer1.DisplayGroupTree = False
CrystalReportViewer1.DisplayToolbar = False
1、使用Web 窗体 Viewer 工具栏上的“打印”按钮将报表导出为 PDF。
2、使用Web 窗体 Viewer 工具栏上的“导出”按钮,导出报表为可以由客户端的现有应用程序打印的格式。
3、使用PrintToPrinter 方法从服务器打印报表。
4、将报表作为一个连续的页提供以通过 Internet Explorer 浏览器在客户端启用打印。
如果用户无权访问打印导出的报表所需的应用程序,并且服务器端打印存在安全性或访问权限问题,您可能需要使用户能够从他们的浏览器打印报表。此方法将整个报表作为一个连续的页显示在 Web 窗体 Viewer 控件中,因而能够使用浏览器的打印功能。
在应用程序中,可以在现有 Web 窗体 Viewer 旁边添加一个按钮,该按钮可以将客户端重定向到新的、在浏览器中将整个报表显示为一个连续页的 Web 窗体 Viewer。可以对第二个窗体上的查看器进行格式化,以便禁用组树和工具栏,并将查看器的 SeparatePages 属性设置为 False。
注意 这种打印方法有一个局限,即无法控制页眉、页脚和分页符的定位。
crReportDocument = New Income_Statement()
CrystalReportViewer1.ReportSource = crReportDocument
CrystalReportViewer1.SeparatePages = False
CrystalReportViewer1.DisplayGroupTree = False
CrystalReportViewer1.DisplayToolbar = False
打印:下载后在 PDF 里搜索 web print……Crystal Reports for Visual Studio .NET高级编程
英文版 Ebook 下载:
http://www.crystaldecisions.com/products/dev_zone/downloads/wrox4_report_integration_web.pdf参考:
将水晶报表放在DIV中,然后用JS打印。
如:
JS
function printpage(m_printpage1)
{
var newstr =document.all.item(m_printpage1).innerHTML
//document.all.item(m_printpage1).innerHTML var oldstr = document.body.innerHTML;
document.body.innerHTML=newstr; window.print();
document.body.innerHTML = oldstr;
return false;
} HTML:
<div id="m_printpage">
<CR:CrystalReportViewer id="CrystalReportViewer1" runat="server" HasSearchButton="False" HasZoomFactorList="False" HasPageNavigationButtons="False" HasGotoPageButton="False" HasDrillUpButton="False" EnableDrillDown="False" DisplayToolbar="False"></CR:CrystalReportViewer>
</div>
中国软件--专栏作家--海波.NET(haibodotnet)专栏
http://www.csdn.net/develop/MY_article.asp?author=haibodotnet