asp.net不用CrystalReportViewer 直接打印
2006-11-29 20:11
337 查看
给页面放一个DropdownList,在PageLoad事件里添加以下代码:
For Each iprt As String In System.Drawing.Printing.PrinterSettings.InstalledPrinters
DropDownList1.Items.Add(iprt)
Next
放一个Button,点击事件为:
Dim reportDoc As ReportDocument = New ReportDocument()
reportDoc.Load(Server.MapPath("CrystalReport1.rpt"))
reportDoc.PrintOptions.PrinterName = DropDownList1.SelectedItem.Text
reportDoc.PrintToPrinter(1, False, 0, 0)
在VS2005上测试通过。
今天发现一个好的办法,给画面拖一个CrystalReportSource空间CrystalReportSource1,拖一个sqldatasource,在sqldatasource中进行数据筛选,然后将它与CrystalReportSource绑定,执行下边几句进行打印
CrystalReportSource1.DataBind(); '取出筛选的数据
CrystalReportSource1.ReportDocument.PrinterName = DropDownList1.SelectedItem.Text
CrystalReportSource1.ReportDocument.PrintToPrinter(1, False, 0, 0)
For Each iprt As String In System.Drawing.Printing.PrinterSettings.InstalledPrinters
DropDownList1.Items.Add(iprt)
Next
放一个Button,点击事件为:
Dim reportDoc As ReportDocument = New ReportDocument()
reportDoc.Load(Server.MapPath("CrystalReport1.rpt"))
reportDoc.PrintOptions.PrinterName = DropDownList1.SelectedItem.Text
reportDoc.PrintToPrinter(1, False, 0, 0)
在VS2005上测试通过。
今天发现一个好的办法,给画面拖一个CrystalReportSource空间CrystalReportSource1,拖一个sqldatasource,在sqldatasource中进行数据筛选,然后将它与CrystalReportSource绑定,执行下边几句进行打印
CrystalReportSource1.DataBind(); '取出筛选的数据
CrystalReportSource1.ReportDocument.PrinterName = DropDownList1.SelectedItem.Text
CrystalReportSource1.ReportDocument.PrintToPrinter(1, False, 0, 0)
相关文章推荐
- ASP.NET学习笔记(20081023)----给Reportviewer的ToolBar上加上打印按钮
- .NET 打印水晶报表(CrystalReport)时,出现“查询引擎错误 C:/DOCUME~1/wt/ASPNET/LOCALS~1/Temp/temp_bd09398e-5eb7-4ca5-a8ee-6ebf63581d18.rpt"
- 在asp.net里创建CrystalReportViewer时老是出错,后来在这里查了些资料才搞定要在web.config中设置如下
- 在asp.net里创建CrystalReportViewer时老是出错,后来在这里查了些资料才搞定要在web.config中设置如下 选择自 laihua 的 Blog
- FastReport ASP.Net开发Web报表时直接打印的问题
- HttpModule 实现 ASP.Net (*.aspx) 中文简繁体的自动转换,不用修改原有的任何代码,直接部署即可!
- ASP.NET中利用Crystal Report创建图表 (初学)
- 面试题-ASP.Net下如何驱动Crystal Report?
- 折腾 VS2008 + ReportViewer + CrystalReports + PrintControl.cab 实现水晶报表本地打印
- Using the ASP.NET 2.0 ReportViewer in Local Mode
- 折腾 VS2008 + ReportViewer + CrystalReports + PrintControl.cab 实现水晶报表本地打印
- 水晶報表直接打印到指定打印機(Crystal Report Direct Print )
- VS2008 + ReportViewer + CrystalReports + PrintControl.cab 实现水晶报表本地打印
- 使用CrystalReportViewer打印通讯错误的问题
- 折腾 VS2008 + ReportViewer + CrystalReports + PrintControl.cab 实现水晶报表本地打印
- Fix: ReportViewer Asp.Net session has expired
- ASP.NET中利用Crystal Report创建图表 转自:http://www.souzz.net
- 折腾 VS2008 + ReportViewer + CrystalReports + PrintControl.cab 实现水晶报表本地打印
- ASP.NET下基于WebService实现CrystalReport与数据库的连接
- ASP.NET下crystalreport参数输入的动态化