Reportviewer: Show Reports in Print Layout With Page Width Zoommode

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



Leave a reply



Submit