代码之家  ›  专栏  ›  技术社区  ›  David Huthaifah Kholi

将Crystal报表直接打印到打印机

  •  0
  • David Huthaifah Kholi  · 技术社区  · 7 年前

    我正在一个程序中创建一个标签打印函数,它需要为给定的信息创建标签。我已经在Crystal Reports 9中创建了一个标签,但是我在打印它时遇到了问题。

    我不想保存标签,我只想在系统创建标签后直接打印它。

    Dim ap9 As craxdrt.Application
    Dim rpt9 As craxdrt.Report
    Dim dbt As craxdrt.DatabaseTable
    
    Set ap9 = New craxdrt.Application
    On Error GoTo errError2
    
    Set iniFile = New CIniFile
    On Error GoTo errError3
    
    Set rpt9 = ap9.OpenReport(iniFile.pathReports & REPORT_LABEL_IN)
    On Error GoTo errError4
    
    For Each dbt In rpt9.Database.Tables
        dbt.Location = iniFile.pathDbCosmet
        If dbt.ConnectionProperties.count <= 5 Then
            dbt.ConnectionProperties.Add "Database Password", iniFile.passwordCosmet
        End If
    Next
    
    rpt9.RecordSelectionFormula = sFormula
    rpt9.PrintOut False, CInt(txtPacksReceived.Text)
    

    enter image description here

    在点击“打印”之后,我看到了另一个对话框

    enter image description here

    但是,代码执行得很好,没有错误,但是打印队列不显示任何文档,报表也不打印。

    为什么我不能打印我的标签?

    2 回复  |  直到 7 年前
        1
  •  0
  •   Harambe    7 年前

    我以前遇到过斑马打印机的问题,结果都和司机有关。您是否已卸载打印机驱动程序并重新安装?否则,请尝试拔下并卸下设备,将其插入其他端口,然后重试?

        2
  •  0
  •   Arvo    7 年前

    很可能您的报表不包含任何数据—选择/抑制公式中存在某些逻辑错误或类似错误。