【问题标题】:How to set SSRS report page size from ReportViewer.cs page?如何从 ReportViewer.cs 页面设置 SSRS 报告页面大小?
【发布时间】:2017-08-24 07:13:08
【问题描述】:

就我而言,我只会在运行时知道报告页面大小。因此,我需要能够使用 ReportViewer.aspx.cs 页面中的 C# 代码设置 SSRS 报告页面大小(我将从该页面加载报告文件)。 请帮帮我

【问题讨论】:

    标签: c# asp.net reporting-services


    【解决方案1】:

    根据https://forums.asp.net/t/2053895.aspx?How+to+set+page+size+in+a+Report+viewer+in+Microsoft+ReportViewer+WebForms 此代码将起作用:

    System.Drawing.Printing.PageSettings pg=new System.Drawing.Printing.PageSettings();
    pg.Margins.Top = 0;
    pg.Margins.Bottom = 0;
    pg.Margins.Left = 0;
    pg.Margins.Right = 0;
    System.Drawing.Printing.PaperSize size = new PaperSize();
      // If you need A5 size then try:
    //size.RawKind = (int)PaperKind.A5;
    // pg.PaperSize = size;
    
    
    this.reportViewer1.SetPageSettings(pg);
    this.reportViewer1.RefreshReport();
    

    MSDN 上的更多文档,您可以点击链接获取有关 PageSettings 类的各种详细信息:https://msdn.microsoft.com/en-us/library/microsoft.reporting.webforms.reportviewer.setpagesettings.aspx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多