在 Web 上打印水晶报表的四种方法请参见:报表分发如果想使用户能够打印在 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
水晶报表在 WEB 上的应用 打印:下载后在 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;
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>
CLASSID="CLSID:2DEF4530-8CE6-41C9-84B6-A54536C90213"
WIDTH=100% HEIGHT=99%
CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=9,2,0,442">
<PARAM NAME="EnableDrillDown" VALUE=1>
<PARAM NAME="EnableExportButton" VALUE=1>
<PARAM NAME="DisplayGroupTree" VALUE=1>
<PARAM NAME="EnableGroupTree" VALUE=1>
<PARAM NAME="EnableAnimationControl" VALUE=1>
<PARAM NAME="EnablePrintButton" VALUE=1>
<PARAM NAME="EnableRefreshButton" VALUE=1>
<PARAM NAME="EnableSearchControl" VALUE=1>
<PARAM NAME="EnableZoomControl" VALUE=1>
<PARAM NAME="EnableSelectExpertButton" VALUE=0>
</OBJECT><SCRIPT LANGUAGE="VBScript">
<!--
Sub window_onLoad()
Page_Initialize()
End SubSub Page_Initialize
On Error Resume Next
Dim webBroker
Set webBroker = CreateObject("WebReportBroker9.WebReportBroker")
if err.number <> 0 then
window.alert "_LOC_The Crystal ActiveX Viewer is unable to create its resource objects_ENDLOC_."
else
Dim webSource0
Set webSource0 = CreateObject("WebReportSource9.WebReportSource")
webSource0.ReportSource = webBroker
webSource0.URL = "/scrreports/1N2Y.rpt"
webSource0.PromptOnRefresh = True
CRViewer.ReportSource = webSource0
end if
CRViewer.ViewReport
End Sub
-->
</SCRIPT>