简体   繁体   English

打印由 Microsoft 报告查看器生成的报告

[英]Print a report generated by Microsoft's Report Viewer

I have used to Microsoft Report wizard to create a Report (a delivery receipt) for a Transport application.我已经使用 Microsoft Report 向导为 Transport 应用程序创建报告(交货收据)。 Now I want the end user to be able to print the receipt as soon as he clicks a button.现在我希望最终用户能够在单击按钮后立即打印收据。 The problem is that on click of a button the report is first loaded and then he has to select the print button.问题是单击按钮时首先加载报告,然后他必须 select 打印按钮。 I want to automate the process of loading and printing.我想自动化加载和打印的过程。 The guy has to print about 200-300 receipts a day and it is very time consuming to follow the current method!这家伙每天要打印大约 200-300 张收据,按照现在的方法非常耗时!

I am developing using C# and working on Microsoft visual studio 2010. I am working on winForms desktop application and the report is local我正在使用 C# 进行开发并在 Microsoft Visual Studio 2010 上工作。我正在开发 winForms 桌面应用程序,报告是本地的

Have a look at this: http://msdn.microsoft.com/en-us/library/ms252091.aspx看看这个: http://msdn.microsoft.com/en-us/library/ms252091.aspx

It generates a file and prints that to the default printer.它生成一个文件并将其打印到默认打印机。 I have used this a derivative of this before, and it worked OK (if I remember correctly) but I had to add some code to clear down the EMF file once printed.我之前使用过它的衍生产品,它工作正常(如果我没记错的话),但我必须添加一些代码来清除打印后的 EMF 文件。

Seems like a lot of code to do something so simple, but it may help?似乎有很多代码来做如此简单的事情,但它可能会有所帮助吗?

If you are using crystal report, you could use ReportDocument.PrintToPrinter method.如果您使用的是水晶报表,您可以使用ReportDocument.PrintToPrinter方法。 Have a look at this .看看这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM