【发布时间】:2018-09-18 03:48:10
【问题描述】:
我对 ActiveReport 完全陌生。
我有一个使用 ActiveReport 2.0 的旧版 VB6 代码。 打印流程如下(代码是VB,ar的初始化没有显示)
Dim ar as DDActiveReports2.ActiveReport
Dim aborted As Boolean
aborted = False
ar.Printer.StartJob("some job")
For i = 0 To ar.Pages.Count - 1
ar.Printer.StartPage()
If ar.Printer.Status = DDActiveReports2.JobStatus.ddJSAborted Then
ar.Printer.AbortJob()
aborted = True
Exit For
End If
ar.Printer.PrintPage(ar.Pages(i), left, top, width, height)
ar.Printer.EndPage()
Next
If Not Aborted Then
ar.Printer.EndJob()
End If
我正在尝试将其迁移到 ActiveReport for .NET。经过一番研究,我发现这里最好的替代品是 ActiveReports.SystemPrinter。迁移后的代码可能如下(未显示 ar 的初始化),
Dim ar As ActiveReports.Document.SectionDocument
Dim aborted As Boolean = False
Dim printer As New ActiveReports.SystemPrinter
printer.StartJob("some job")
For i = 0 To ar.Pages.Count - 1
printer.StartPage()
If ??? Then
printer.AbortJob()
aborted = True
Exit For
End If
ar.Pages(i).Draw(printer.Graphics, New RectangleF(left, top, width, height))
printer.EndPage()
Next
If Not Aborted Then
printer.EndJob()
End If
但是,我无法在 ActiveReport2 中找到 printer.Status,并且无法知道打印中止状态 DDActiveReports2.JobStatus.ddJSAborted。
我不太确定 DDActiveReports2.JobStatus.ddJSAborted 到底是什么,我猜用户可能会在 Windows 打印任务窗口中取消打印。一旦取消,程序将取消所有剩余页面。
但是,这似乎不能在 .NET 中完成?我错过了什么吗?
请帮忙。
谢谢。
【问题讨论】:
标签: .net printing reporting activereports