当我使用Crystal Reports从Vb.Net打印时,文档状态正在等待...... [英] When I Print From Vb.Net Using Crystal Reports, Document Status Is Pending ...
本文介绍了当我使用Crystal Reports从Vb.Net打印时,文档状态正在等待......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我在使用CrystalReports从VB.NET打印时遇到问题,我直接打印到打印机,我的代码是:
Hello,
I have a problem in printing from VB.NET using CrystalReports, i print directly to the printer, my code is:
Dim crtableLogoninfos As New TableLogOnInfos
Dim crtableLogoninfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim CrTables As Tables
With crConnectionInfo
.ServerName = myCon.ServerName
.DatabaseName = myCon.DBName
.UserID = "sa"
.Password = ""
End With
Dim iRpt As New rptBarcode
iRpt.Load()
Dim CrTable As Table
CrTables = iRpt.Database.Tables
For Each CrTable In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
iRpt.Refresh()
Dim iPrd As New System.Drawing.Printing.PrintDocument
iRpt.PrintOptions.PrinterName = iPrd.PrinterSettings.PrinterName
iRpt.PrintToPrinter(1, False, 0, 0)
iRpt.Dispose()
iRpt.Close()
但是当我运行此代码时,打印机文档将进入打印队列,其状态为待定但未实际打印。请注意,我尝试从word,excel和打印机等其他软件进行打印。
我的代码是真的吗?什么是可能的问题。
But when i run this code the printer document go to the printing queue and its status is Pending but not physically printed. Note that i tried to print from other softwares like word, excel and the printer works properly.
Is my code true? And what is the possible problem.
推荐答案
看起来报表查看器没有将ENDDOCPRINT发送到打印假脱机程序 - 但是根据文档 [ ^ ]您的参数是正确的。
然而,我会在Dispose()之前移动Close()
It looks like the report viewer is not sending the ENDDOCPRINT to the print spooler - but according to the documentation [^] your parameters are correct.
I would, however, move Close() before Dispose()
这篇关于当我使用Crystal Reports从Vb.Net打印时,文档状态正在等待......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文