LocalReport Print with C # (C # Print RDLC)

Source: Internet
Author: User

Code

 1 # region public static
2 /// <summary>
3 // obtain the total number of physical pages of the specified ReportViewer
4 // new guog2009-05-06
5 /// </summary>
6 /// <param name = "reportViewer"> ReportViewer Control </param>
7 // <returns> total number of physical pages. The default value is 0. </returns>
8 public static int GetTotalPage (ReportViewer reportViewer)
9 {
10 int result = 0;
11 // set to print preview mode
12 reportViewer. SetDisplayMode (DisplayMode. PrintLayout );
13
14 // record the current page
15 int currentPage = reportViewer. CurrentPage;
16 if (reportViewer. LocalReport. GetTotalPages ()> 0)
17 {// the built-in GetTotalPages () method returns the total number of logical pages.
18
19 while (true)
20 {
21 try
22 {
23 reportViewer. CurrentPage + = 1;
24}
25 catch
26 {
27 reportViewer. CurrentPage-= 1;
28 result = reportViewer. CurrentPage;
29 break;
30}
31 finally
32 {
33 // specify the original location
34 reportViewer. CurrentPage = <

Related Article

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.