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;
MainReportViewer.SetPageSettings(settings);
Thanks
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
ReportViewer1.SetPageSettings(instance);
Here is similar question with answer
I assume that you are running server reports (you said SSRS). Take a look at http://msdn.microsoft.com/en-us/library/ms159195.aspx. 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
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly