【问题标题】:How to silently print a RDLC如何静默打印 RDLC
【发布时间】:2014-05-05 18:19:35
【问题描述】:

我正在开发一个 Winforms 应用程序,按照 tutorial 使用 XML 文件制作报告。现在我需要在特定类型的打印机'BIXOLON' 和特定类型的纸张上打印它,我需要包含此信息然后执行打印。

我尝试从msdn 复制并粘贴此代码,但出现错误:

本地报告处理过程中发生错误。

在那条线上

    private void Export(LocalReport report)
    {
        string deviceInfo =
          @"<DeviceInfo>
            <OutputFormat>EMF</OutputFormat>
            <PageWidth>8.5in</PageWidth>
            <PageHeight>11in</PageHeight>
            <MarginTop>0</MarginTop>
            <MarginLeft>0</MarginLeft>
            <MarginRight>0</MarginRight>
            <MarginBottom>0</MarginBottom>
        </DeviceInfo>";
        Warning[] warnings;
        m_streams = new List<Stream>();
       /*>>>>>*/ report.Render("Image", deviceInfo, CreateStream, out warnings);
    }

我不知道如何直接打印到打印机

【问题讨论】:

    标签: c# winforms printing rdlc


    【解决方案1】:

    来自 MSDN 的代码使用PrintDocument 打印报告。 只需将此属性设置为使用特定打印机:

    printDoc.PrinterSettings.PrinterName = "NameOfYourPrinter"
    

    如果您在Report.Render 上遇到错误,则可能是您的 rdlc 文件有问题。您可以在 ReportViewer 中查看它而不会出错吗?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-05
      • 2013-11-08
      • 2017-06-16
      • 2012-07-06
      • 2015-06-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多