当前位置:编程学习 > C#/ASP.NET >>

LocalReport Print with C#(C#打印RDLC)

\代码
1 #region public static
2 /// <summary>
3 /// 获取指定ReportViewer总物理页数
4 /// guog2009-05-06新增
5 /// </summary>
6 /// <param name="reportViewer">ReportViewer控件</param>
7 /// <returns>总物理页数,默认值为0</returns>
8   public static int GetTotalPage(ReportViewer reportViewer)
9 {
10 int result = 0;
11 //设置为打印预览模式
12   reportViewer.SetDisplayMode(DisplayMode.PrintLayout);
13
14 //记录当前页
15   int currentPage = reportViewer.CurrentPage;
16 if (reportViewer.LocalReport.GetTotalPages() > 0)
17 {//自带的GetTotalPages()方法返回的是逻辑页面总数,所以这里重新处理
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 //指定到原始位置
34   reportViewer.CurrentPage =<
补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,