开发者

SSRS 2005 ReportViewer is 'Shrinking' my Reports

I've put together several reports which render exactly as I'd like them to in the preview in Visual Studio, but when I view them in a web browser, they render as required initially but are quickly squished into the left half of the browser window by the viewer. The zoom level is set to 100% - setting it to Page Width zooms the report out to fill the page but it doesn't correct the line breaks it has made when the initial 'squish' happens.

Does anyone kn开发者_开发知识库ow how to prevent the viewer from doing this resize?

Also, does the ReportViewer automatically disable the maximize button on its parent browser window? I'm quite new to all this....

Thanks, Dan


The report shrinking problem in CHROME when using SSRS 2005 can be solved by the following solution. It works ALWAYS, even if you have more than one page and if you export your report.

Steps to follow:

  1. Open Page Footer
  2. Drag a rectangle on it
  3. Set rectangle Location as:
    • Left = 0
    • Top = 0
  4. Set rectangle size as:
    • Width = "the Width of your report"
    • Height = 0.1

By the above settings, the rectangle will not show.


The way we do it in my company is to insert a Page header, drop a line component on it, make it the same width as the report, and of a neutral colour that won't be displayed on run time (printing).

The accepted solution above won't work in all the cases, especially when you set up a subscription to send the report by email to the client.


Our fix was to increase the Height and Width by Javascript:

var t1;
function manageWidthReportViewer(behID) {
    t1 = window.setInterval("SetWidthForCrome()", 1);
}
function SetWidthForCrome() {

     var mainReportViewer = document.getElementById('iFrameMainReportViewerContainer'); 
    var reportFrame = mainReportViewer.contentWindow.document.getElementById('ReportFramereportViewer');
    var report = reportFrame.contentWindow.document.getElementById("report");
    if(mainReportViewer.contentDocument.getElementById("reportViewer") != null)
        mainReportViewer.contentDocument.getElementById("reportViewer").childNodes[2].childNodes[1].childNodes[1].style.float = "left";
    if (report!=null && report.contentDocument.getElementById("oReportCell") != null) {
        report.contentDocument.getElementById("oReportCell").style.width="100%";

        window.clearInterval(t1);
    }
}

function SetReportViewerDim() {
    var controlPanelHeight = screen.availHeight - 210;

    var mainReportViewer = document.getElementById('iFrameMainReportViewerContainer'); //set
    mainReportViewer.removeAttribute('height');
    mainReportViewer.style.height = (controlPanelHeight-37) + "px";

    var reportViewer = mainReportViewer.contentWindow.document.getElementById('reportViewer'); //set
    reportViewer.style.height = (controlPanelHeight) + "px";

    var reportFrame = mainReportViewer.contentWindow.document.getElementById('ReportFramereportViewer');

     if (Sys.Browser.name == "Safari") {
    manageWidthReportViewer(reportFrame);
    }

}


After a lot more digging, I've found the solution to SSRS shrinking my reports. For reference, you have to do three things

  1. Delete the declaration from my hosting aspx page
  2. Set the ReportViewer's AsyncRendering property to false.
  3. Set the ReportViewer's Width property to 100%

Apparently there is a bug in SSRS 2005 with its XHTML rendering engine which is now fixed with the engine rebuild in SSRS 2008.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜