假设我有两个单独的报告,并且我想在水晶报告查看器中显示它然后打印它。
我在这个link reference中尝试了1号解决方案。我在我的(to top, blue, blue)
中添加了2个水晶报表查看器。
然后我使用下面的代码,但只显示和打印一份报告。
Winforms
更新即可。我是这样做的。打印成功但我只在报告查看器中查看第一个报告。我无法找到同时查看我的两份报告的设置
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class frmStPeter
Private Sub frmStPeter_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim c As Integer
Dim doctoprint As New System.Drawing.Printing.PrintDocument()
doctoprint.PrinterSettings.PrinterName = "EPSON L120 Series on PC1"
Dim Report As New ReportDocument
Report.Load("C:\CRep\stPeter.rpt")
Report.Load("C:\CRep\stAnthony.rpt")
Dim rawKind As Integer
For c = 0 To doctoprint.PrinterSettings.PaperSizes.Count - 1
If doctoprint.PrinterSettings.PaperSizes(c).PaperName = "ClassSchedule" Then
rawKind = CInt(doctoprint.PrinterSettings.PaperSizes(c).GetType().GetField("kind", Reflection.BindingFlags.Instance Or Reflection.BindingFlags.NonPublic).GetValue(doctoprint.PrinterSettings.PaperSizes(c)))
Exit For
End If
Next
Report.PrintOptions.PaperSize = CType(rawKind, CrystalDecisions.Shared.PaperSize)
Report.PrintToPrinter(1, False, 1, 1)
CR1.ReportSource = Report
CR2.ReportSource = Report
CR1.Refresh()
CR2.Refresh()
End Sub
End Class
任何人都可以帮我解决这个问题。谢谢
答案 0 :(得分:0)
Crystal Report 9不支持多个报告视图。例如,您使用的表单名称为frmView,而此表单具有crviewer 9,并且希望在整个项目中使用该表单。在这方面,您可以打印Jv并已对其进行查看,然后再次打开现金收据凭证并单击“打印”按钮,但查看器既未打开另一个选项卡,也没有任何功能可在同一查看器中显示两个打印视图。抱歉,已经太晚了。