ReportViewer displaying report in wrong orientation
Hi, We are developing an ASP.NET web application, and we're using VS2008 and SSRS 2008 R2 with server-side reports. We have a number of reports, some designed to be landscape and some in portrait. We have an aspx page containing the ReportViewer control, but when run, it seems the ReportViewer always displays the report in portrait, even for the landscape reports, but when printing it prints the report in the correct orientation as it's designed. The problem is that when shown in the ReportViewer it shows a different number of pages than when it prints. For example if the report is designed in landscape, the report viewer will say the report has 4 pages (because it displays in portrait), but when printed the report is actually 9 pages (because it's landscape). Our landscape reports are set to landscape, also the paper size and the Interactive size are both set to 11 inch in width and 8.5 inch in height. Is there a way to make sure the ReportViewer display the report in the correct orientation of the report as it's designed (so the page numbers will match when viewed and printed)? Thank you.
November 18th, 2010 6:43pm

Zoom Mode / SizetoReportContent & Async rendering properties can all affect how a report diplays - as can the properties of the container - is it in an i-frame or other hard sized control?Rgds Geoff
Free Windows Admin Tool Kit Click here and download it now
November 18th, 2010 7:48pm

The ReportViewer is set to ZoomMode = FullPage, SizeToReportContent = true, and AsyncRendering = false, it's not in an iFrame just simply placed in a <div> and in an aspx web page. Here is the entire page: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyReportViewer.aspx.cs" Inherits="MyReportViewer" %> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Report Viewer</title> </head> <body> <form id="frmReportViewer" runat="server"> <div style="overflow:visible; margin-top:10px; background-color:#FFFFFF; width:1000px;"> <rsweb:ReportViewer ID="rvReport" runat="server" ProcessingMode="Remote" ShowExportControls="false" AsyncRendering="false" SizeToReportContent="true" ZoomMode="FullPage" Height="100%" Width="100%"> <ServerReport ReportPath="" ReportServerUrl="" /> </rsweb:ReportViewer> </div> </form> </body> </html>Bill
November 19th, 2010 12:29pm

Point 1: ZoomMode="FullPage" will override: Height="100%" Width="100%" Size to reportcontent may be your issue depending on how the report is physically laid out (ie if it is taller than it is wide, it will create a portrait report) so try: <rsweb:ReportViewer ID="rvReport" runat="server" ProcessingMode="Remote" ShowExportControls="false" AsyncRendering="false" ZoomMode="FullPage" > <ServerReport ReportPath="" ReportServerUrl="" /> </rsweb:ReportViewer> You may or may not need to set SizeToReportContent="false"Rgds Geoff
Free Windows Admin Tool Kit Click here and download it now
November 21st, 2010 5:38pm

Hi, The page numbers when viewed and printed are not match is resulted from the Margins properties of the report are only applied in physical pagination (Print or export to PDF...). For example, if the InteractiveSize and the PageSize are both set to 11 inch in width and 8.5 inch in height, the Margins of the report are 1 inch, then the actual size of print area is 9(11-1-1) in width and 6.5(8.5-1-1) in height, so report will be generated in more pages when printed. In order to make the page numbers matches, we can use either one of the approaches listed below based on your requirement: · Increase the PageSize to 13in x 10.5in · Decrease the InteractiveSize to 9in x 6.5in · Set the Margins to 0. Thanks, Tony ChainPlease remember to mark the replies as answers if they help and unmark them if they provide no help
November 22nd, 2010 4:03am

Thanks for your help, but it still doesn't work. The report still shows up as portrait in report viewer but prints in landscape (the correct orientation is landscape). For Geoff removing the Width, Height and SizeToReportContent="false" displays the report in a very small size initially, I need to set the SizeToReportContent="true" for the report to show up in full size. For Tony, I tried all 3 of your suggestions but none worked. I have a report that's set to landscape, and both the PageSize and the InteractiveSize are set to 11inx8.5in (WxH), and the margins are all 0s, but the report still shows up as portrait. When I compare to the printed report, each page shown in the report viewer has about twice the data as the printed report has. And when I changed the zoom percentage of the report viewer to 50% in order to see the entire report, the report looks very much portrait (the height is much more than the width), however nothing is cut off in the report (the report header would not have fit in the portrait 8.5in size). Question, how does the report viewer know to display a report in landscape or portrait? And how does the report viewer know how much data to display in a page? I looked at the report RDL file (opened in notepad) there is no such thing as orientation, it only has the page size and the interactive size and margins. Does the report viewer determine how the report should be displayed based on these sizes? I also did some additional testing by designing a bare bone report from scratch and set it to portrait, page size and interactive size are set to 8.5inx11in (WxH), margin is 0in all around, and I have a table in the middle of the report that has 2 columns, and when I displayed the report in the report viewer it also shows a lot more data on each of the page than when it prints. So this issue seems to exist for both portrait and landscape reports. It seems that the report viewer estimates the number of the data to be displayed on each page, therefore the page numbers in the report viewer seem to be at best estimated. Am I correct? Is this because of the server-side reporting I'm using? Would it be different if I had used local reporting? Bill
Free Windows Admin Tool Kit Click here and download it now
November 22nd, 2010 5:26pm

Thanks for your help, but it still doesn't work. The report still shows up as portrait in report viewer but prints in landscape (the correct orientation is landscape). For Geoff removing the Width, Height and SizeToReportContent="false" displays the report in a very small size initially, I need to set the SizeToReportContent="true" for the report to show up in full size. For Tony, I tried all 3 of your suggestions but none worked. I have a report that's set to landscape, and both the PageSize and the InteractiveSize are set to 11inx8.5in (WxH), and the margins are all 0s, but the report still shows up as portrait. When I compare to the printed report, each page shown in the report viewer has about twice the data as the printed report has. And when I changed the zoom percentage of the report viewer to 50% in order to see the entire report, the report looks very much portrait (the height is much more than the width), however nothing is cut off in the report (the report header would not have fit in the portrait 8.5in size). Question, how does the report viewer know to display a report in landscape or portrait? I looked at the report RDL file (opened in notepad) there is no such thing as orientation, it only has the page size and the interactive size and margins. Does the report viewer determine how the report should be displayed based on these sizes? Bill
November 22nd, 2010 5:26pm

I think it is the sizetoreportcontent that is throwing the orientation off as you say that the report "looks very much more portrait" My only further suggestion here would be again to remove the sizetoreportcontent and look at combinations of zoom or height/width to get the view you need....not very sophisticated I know but the only thing that has worked for me in the pastRgds Geoff
Free Windows Admin Tool Kit Click here and download it now
November 24th, 2010 7:22pm

I think it is the sizetoreportcontent that is throwing the orientation off as you say that the report "looks very much more portrait" My only further suggestion here would be again to remove the sizetoreportcontent and look at combinations of zoom or height/width to get the view you need....not very sophisticated I know but the only thing that has worked for me in the pastRgds Geoff
November 24th, 2010 7:22pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics