1

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

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

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

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

4

1 回答 1

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-07-22T19:07:38.837 回答