Crystal Report programming printing)

Source: Internet
Author: User

The crystal report viewer crystalreportviewer comes with the printing function, which calls the default printer of the current system for printing. However, the crystal version in. Net does not support web printing and must be later than 10. For other reasons, most of us need to writeCodePrinting involves how to write code and set print parameters. The following are some basic knowledge:

Print the basic code:

Crystalreport1 report = new crystalreport1 (); // report your own report name
Pagemargins margins;
Margins = report. printoptions. pagemargins;
Margins. bottommargin = 250;
Margins. leftmargin = 350;
Margins. rightmargin = 350;
Margins. topmargin = 350;
// Apply the page margins.
Report. printoptions. applypagemargins (margins );

// Select the printer.
String printername = "\\\\\ LAN machine name \ printer name (for example, HP 2100)"; // specify the name of the local printer directly
Report. printoptions. printername = printername; // specify the printer name
Report. printoptions. papersize = papersize. papera4; // specify the paper size.

Report. printtoprinter (1, true, 1, 4 );

This article is written by xwdd129. For more information, see the source. Thank you!

The following briefly describes the printed parameters:

Printoptions class, which provides attributes and methods for setting the report printing options.

Printoptions members:
Pagecontentheight --- int32, get the height of the page content
Pagecontentwidth --- int32 to get the page content width
Pagemargins --- get the report margins
Pageorientation --- get or set the printer paper direction
Pagesize --- get or set the size of the current printer paper
Printername --- string, used to obtain or set the printer name for the report

ReportDocument. printtoprinter Method
Public Virtual void printtoprinter (INT ncopies, bool collated, int startpagen, int endpagen)
Ncopies indicates the score to be printed
Collated indicates whether to print each copy
Startpagen indicates the first page to be printed
Endpagen indicates the last page to be printed

From: http://blog.csdn.net/xwdd129/archive/2006/06/01/768033.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.