Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Crystal Report Viewer以编程方式打印到默认打印机_C#_Winforms_Visual Studio 2010_Crystal Reports - Fatal编程技术网

C# Crystal Report Viewer以编程方式打印到默认打印机

C# Crystal Report Viewer以编程方式打印到默认打印机,c#,winforms,visual-studio-2010,crystal-reports,C#,Winforms,Visual Studio 2010,Crystal Reports,我有一个水晶报告,我已经导入到表单中,我想要它,这样当我双击某个东西时,它将加载报告,然后打印它 有没有办法通过代码实现这一点?调用报告 将报告的指定页面打印到使用PrintOptions.PrinterName属性选择的打印机如果未选择打印机,将使用报告中指定的默认打印机。 大概是这样的: using (var report = new YourCrystalReport()) { // Call report.SetDataSource() if necessary // C

我有一个水晶报告,我已经导入到表单中,我想要它,这样当我双击某个东西时,它将加载报告,然后打印它

有没有办法通过代码实现这一点?

调用报告

将报告的指定页面打印到使用PrintOptions.PrinterName属性选择的打印机如果未选择打印机,将使用报告中指定的默认打印机。

大概是这样的:

using (var report = new YourCrystalReport())
{
    // Call report.SetDataSource() if necessary
    // Call report.SetParameterValue() as necessary

    report.PrintToPrinter(...);
}
虽然我链接的文档是VS2003,但我只是在VS2012中使用了最新的crystal驱动程序进行了尝试,调用结果似乎是一样的