水晶报告 |印刷 |默认打印机 [英] Crystal Report | Printing | Default Printer

查看:17
本文介绍了水晶报告 |印刷 |默认打印机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个应用程序,用户将在其中打印我使用 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 文档MSDN 文档 了解如何指定 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);
}

这篇关于水晶报告 |印刷 |默认打印机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆