我正在开发一个Winforms应用程序,遵循这个教程来用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);
}我不知道如何直接打印到打印机
发布于 2014-05-13 07:08:06
MSDN的代码使用PrintDocument打印报表。只需将此属性设置为使用特定打印机:
printDoc.PrinterSettings.PrinterName = "NameOfYourPrinter"如果您在Report.Render上出现错误,可能您的rdlc文件中有问题。您能在ReportViewer中查看它吗?
https://stackoverflow.com/questions/23479116
复制相似问题