Printing 活动报告始终发送到默认打印机
我想从活动报告打印到网络打印机,但它总是打印到默认打印机而不会引发错误。 尝试使用.net printdocument库打印后,它将打印到指定的打印机 我不知道为什么在使用activereports时它会打印到默认打印机。设置打印机对象的属性。如下所示:Printing 活动报告始终发送到默认打印机,printing,activereports,Printing,Activereports,我想从活动报告打印到网络打印机,但它总是打印到默认打印机而不会引发错误。 尝试使用.net printdocument库打印后,它将打印到指定的打印机 我不知道为什么在使用activereports时它会打印到默认打印机。设置打印机对象的属性。如下所示: viewer.Document.Printer.PrinterName = "TheNetworkPrinterName"; viewer.Print(); PrinterName属性的值应该是windows中的确切名称。要获取给定系统上有效
viewer.Document.Printer.PrinterName = "TheNetworkPrinterName";
viewer.Print();
PrinterName
属性的值应该是windows中的确切名称。要获取给定系统上有效打印机名称的列表,可以使用PrinterSettings.InstalledPrinters枚举打印机列表。中有一个枚举可用打印机的示例
如果您尝试了某项功能,但发现它不起作用,请向我们提供更多详细信息,我们将尽力帮助您。在最终用户设计器中更改打印机 Grapecityteam回答: 对于SectionReport,您可以在设计器的LayoutChanged事件中插入脚本以在加载报告时更改默认打印机,如下所示:
private void OnLayoutChanged(object sender, LayoutChangedArgs e)
{
if (e.Type == LayoutChangeType.ReportLoad || e.Type == LayoutChangeType.ReportClear)
{
reportToolbox.Reorder(reportDesigner);
reportToolbox.EnsureCategories();
reportToolbox.Refresh();
RefreshExportEnabled();
CreateReportExplorer();
splitContainerMiddle.Panel2Collapsed = reportDesigner.ReportType == DesignerReportType.Section;
if (reportDesigner.ReportType == DesignerReportType.Section)
{
string script = string.Empty;
script += "public void ActiveReport_ReportStart()";
script += "{";
script += "rpt.Document.Printer.PrinterSettings.PrinterName = System.Drawing.Printing.PrinterSettings.InstalledPrinters[3];";
script += "}";
(reportDesigner.Report as SectionReport).ScriptLanguage = "C#";
(reportDesigner.Report as SectionReport).Script = script;
}
}
感谢Grapecity销售和支持您好,感谢您的回复。我已经在分配打印机名了。但它仍然打印到默认打印机。下面是一个重现问题的示例:顺便说一下,我列出了带有InstalledPrinters的打印机,并使用了列表中所示的名称。