How to give dynamic margin in RDLC report

How i can give dynamic margin to the rdlc report in ASP.NET C#?

I have tried this code but it is not working.......

       System.Drawing.Printing.PageSettings settings = new System.Drawing.Printing.PageSettings();
                //hundredth of inch
                settings.Margins.Top = topMargin;
                settings.Margins.Left = leftMargin;
                settings.Margins.Bottom = bottomMargin;
                settings.Margins.Right = rightMargin;


Asked by:- RahulMungra
: 305 At:- 8/11/2021 6:17:28 AM
C# RDLC-report

1 Answers
profileImage Answered by:- vikas_jk

You can give try to this code

   // creates a new page setting
    PageSettings instance = new PageSettings();
    // create the new margin values (left,right,top,bottom)
    Margins value = new Margins(0, 0, 0, 0);
    // gives your new pagesetting a value
    instance.Margins = value;

    // report viewer now sets your margins

Here is similar question with answer

I assume that you are running server reports (you said SSRS). Take a look at Server reports use an ActiveX control to print on the client using JavaScript, and that's also the one you use to set margins and such. This functionality is not available for local (RDLC) reports.

which says as per what I understand you cannot set using C#, but can set margin using JS code

At:- 8/11/2021 12:19:03 PM

Login/Register to answer
Register directly by posting answer/details

Full Name *

Email *

By posting your answer you agree on privacy policy & terms of use