set page layout for report viewer in visual studio 2010
you can use below code:
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();
size.RawKind = (int)PaperKind.A5;
pg.PaperSize = size;
reportViewer1.SetPageSettings(pg);
this.reportViewer1.RefreshReport();
Start by displaying print-layout in VS10 Report Designer when running the form
It looks like you can adjust report viewer properties. I found a adjustment that sets the zoom, in your case (print layout = whole page) so the default would need to be changed.
Here is the VB script for it from MS.
'Declaration
<CategoryAttribute("Appearance")> _
<DefaultValueAttribute(ZoomMode.Percent)> _
Public Property ZoomMode As ZoomMode
'Usage
Dim instance As ReportViewer
Dim value As ZoomMode
value = instance.ZoomMode
instance.ZoomMode = value
I don't know if you have to use a # like value = 50 or if you can use value = Whole Page, it seems like the latter can be used since it bases the figures dimensions on the logical page to assume the view size.
Goood luck and check http://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.reportviewer.zoommode.aspx for further guidance and different code options.
set page layout for report viewer in visual studio 2010
you can use below code:
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();
size.RawKind = (int)PaperKind.A5;
pg.PaperSize = size;
reportViewer1.SetPageSettings(pg);
this.reportViewer1.RefreshReport();
ReportViewer Control - Height issue
Give it a static height that is enough for the entire height of the report. As far as I know 100% will not work because the ReportViewer control is essentially wrapped by one big div
tag.
Related Topics
How to Save/Download Pdf Embedded in Web Page Without a Pdf Filename
Updating an Object from a List in C#
Return Json, But It Includes Backward Slashes "\", Which I Don't Want
How to Pass Parameter from @Url.Action to Controller Function
How to Format a Number in C# With Commas and Decimals
Most Efficient Way to Compare Two Ienumerables (Or Lists) in Linq
What Is the Correct Way to Compare Char Ignoring Case
Build Query String for System.Net.Httpclient Get
How to Format Number as Money Using Regex
Create a C# Method to Generate Auto Increment Id
Removing Elements from Json Based on a Condition in C#
How to Iterate Through the Following Json Using C#
Truncate Two Decimal Places Without Rounding
Declare Properties to Ignore in Entities Interface (Ef Core)
How to Use a Class from One C# Project With Another C# Project
How to Save Mailmessage Object to Disk as *.Eml or *.Msg File