Crystal Report | Printing | Default Printer(水晶报表 |印刷 |默认打印机)
问题描述
我正在制作一个应用程序,用户将打印我使用 Crystal Report 显示的发票.
I am making one application where user will print invoices which I am displaying using Crystal Report.
用户向我展示了他当前使用 ForPro 制作的应用程序.在该应用程序中,在打印机选项表单下,可以看到当前安装的所有打印机,并且用户可以选择默认打印机.制作发票时,用户按下打印按钮,然后有一个对话框询问是否.的副本.输入后,发票直接打印,没有任何打印对话框.如果用户想再次更改打印机,他/她将在打印机选项"表单中进行更改.
The user showed me his current application made using ForPro. In that application, under Printer Options form, one can see all the printers currently installed and the user could select default printer. When the invoice is made, the user presses the print button, then there is one dialog asking for no. of copies. When it's entered, the invoice gets printed directly, without any Print Dialog Box. If the user wants to change the printer again he/she will change it in the Printer Option form.
我想知道 Crystal Report 中是否有类似的事情,并且需要有关如何处理它的指导.
I want to know if similar thing is possible in Crystal Report and need guidance on how to approach for it.
推荐答案
看看ReportDocument.PrintToPrinter SAP Docs 或 MSDN Docs 了解如何指定 PrinterName,然后使用 ReportDocument 对象进行打印.
Take a look at the ReportDocument.PrintToPrinter SAP Docs or MSDN Docs for how to specify the PrinterName and then Print using the ReportDocument object.
如果您可以尝试摆脱 FoxPro 应用程序 UI 如何进行打印机选择.而是使用标准的打印对话框来选择打印机.
If you can try and get away from how the FoxPro app UI for printer selection. Instead use the standard print dialog box to select the printer.
您应该注意,如果您在将报告发送到打印机之前未设置 PrinterName,它将使用 Crystal 文件上的默认值.不要与用户的操作系统默认打印机混淆.
You should note that if you don't set the PrinterName before sending the report to the printer it will use the default on the crystal file. Not to be confused with the user's OS default printer.
这是一个使用 SetParameterValue 方法,然后将报表文档发送到打印机
Here's an example of showing the PrintDialog settings some parameters using the SetParameterValue method and then sending the report document to a printer
// Note: untested
var dialog = new PrintDialog();
Nullable<bool> print = dialog.ShowDialog();
if (print.HasValue && print.Value)
{
var rd = new ReportDocument();
rd.Load("ReportFile.rpt");
rd.SetParameter("Parameter1", "abc");
rd.SetParameter("Parameter2", "foo");
rd.PrintOptions.PrinterName = dialog.PrinterSettings.PrinterName;
rd.PrintToPrinter(1, false, 0, 0);
}
这篇关于水晶报表 |印刷 |默认打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:水晶报表 |印刷 |默认打印机
基础教程推荐
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 将 XML 转换为通用列表 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01