【问题标题】:Directly print RDLC report without showing to user直接打印 RDLC 报告而不显示给用户
【发布时间】:2013-11-12 22:15:00
【问题描述】:

我需要在用户(客户端)机器上的默认打印机上打印 RDLC 报告。

我有一个包含 RDLC 报告的 VB.Net (VS 2008/.Net 3.5) Web 应用程序。部分要求是不向用户显示生成的报告,而是直接在用户默认打印机上打印。用户将单击一个按钮,相应的报告应发送到用户打印机。

任何想法或建议都会非常有帮助。

更新 - 到目前为止,我为 rdlc 报告构建客户端打印的所有尝试都失败了。无法从客户端默认打印机打印它们,只有服务器端打印有效

【问题讨论】:

  • 了解(对于将来有此问题的人)您调查了哪些选项以及为什么它们不起作用会很有帮助。如有可能,请随时编辑问题以添加此信息。
  • 更新 - 到目前为止,我为 rdlc 报告构建客户端打印的所有尝试都失败了。无法从客户端默认打印机打印它们,只有服务器端打印有效

标签: vb.net printing rdlc


【解决方案1】:
I have a solution for the rdlc printing directly without preview.
1. Convert the local report to word.
2. print the word document. You can pop up the print diaglog and let you choose the printer.
sample code like:

'Convert to word:
Dim bytes As Byte() = rptForm.ReportViewer1.LocalReport.Render("WORD", Nothing, mimeType, encoding, extension, streamids, warnings)

 Dim printDlg As New PrintDialog()
 Dim PrinterName as String
 If (printDlg.ShowDialog() = DialogResult.OK) Then
     PrinterName = printDlg.PrinterSettings.PrinterName
 End If

'Print the word document:
Dim appWord As New Word.Application
 appWord.Documents.Open(FullPath, m, m, m, m, m, m, m, m, m, m, m)
 appWord.WordBasic.FilePrintSetup(Printer:=PrinterName , DoNotSetAsSysDefault:=1)
 appWord.ActiveDocument.PageSetup.Orientation = WdOrientation.wdOrientPortrait
 appWord.ActiveDocument.PageSetup.PaperSize = WdPaperSize.wdPaperLetter
                    appWord.ActiveDocument.PrintOut()
                    appWord.Documents.Close()
                    appWord.Quit()
                    appWord = Nothing

【讨论】:

    猜你喜欢
    • 2014-03-14
    • 2016-04-16
    • 2013-07-17
    • 2021-05-17
    • 2018-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多