locked
How to set page size in a Report viewer in Microsoft.ReportViewer.WebForms RRS feed

  • Question

  • User1903078390 posted

    Hi Team

    I am using Report viewer from the below namespace.

    <%

    @ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

    however I am unable to set the pagesize for the report viewer, it is always setting the pagesize to 43, can you please help me how to set this as I have to set it dynamically based on the user preference default being 50.

    Regards

    Sudeep

    Tuesday, June 2, 2015 3:32 AM

Answers

  • User1711366110 posted

    however I am unable to set the pagesize for the report viewer, it is always setting the pagesize to 43, can you please help me how to set this as I have to set it dynamically based on the user preference default being 50
        
          As per this case, you can try the following code in code-behind manually :

    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 like below      //size.RawKind = (int)PaperKind.A5;
        // pg.PaperSize = size;
    
    pg.PaperSize = 50;
    
    this.reportViewer1.SetPageSettings(pg);
    this.reportViewer1.RefreshReport();
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 4, 2015 11:47 PM