developer tip

SSRS 2008 R2-SSRS 2012-ReportViewer : Safari 및 Chrome에서 보고서가 비어 있습니다.

optionbox 2020. 9. 18. 08:06
반응형

SSRS 2008 R2-SSRS 2012-ReportViewer : Safari 및 Chrome에서 보고서가 비어 있습니다.


보고 서비스를 버전 2008에서 다른 서버 버전 2008 R2로 마이그레이션했습니다. 2008 버전에서는 보고서가 Safari에서 제대로 작동합니다. 새 버전 2008 R2에서는 보고서가 전혀 표시되지 않습니다. 내가 보는 것은 매개 변수 섹션이고 보고서는 비어 있습니다. Chrome에서도 동일합니다. Microsoft Safari에 따르면 제한된 방식으로 지원됩니다. 보고서는 복잡하지 않습니다. 실제로 Safari에 표시되는지 확인하기 위해 한 줄만있는 보고서를 만들었지 만 아니요, 해당 보고서도 완전히 비어 있습니다. 누구든지 Safari에서 SSRS 보고서를 볼 수 있도록 만들었습니까? 어떤 종류의 구성 설정을 엉망으로 만들어야합니까?


궁극적 인 솔루션 (SSRS 2012에서도 작동합니다!)

SSRS 서버에서 다음 파일에 다음 스크립트를 추가합니다.
C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager\js\ReportingServices.js

function pageLoad() {    
    var element = document.getElementById("ctl31_ctl10");
    if (element) 
    {
        element.style.overflow = "visible"; 
    }
}

참고 : azzlak이 언급했듯이 div의 이름이 항상 ctl31_ctl10. SQL 2012의 경우 시도 ctl32_ctl09하고 2008 R2의 경우 ctl31_ctl09. 이 솔루션이 작동하지 않으면 브라우저에서 HTML을보고 스크립트가 overflow:auto속성을 overflow:visible.


ReportViewer 제어를위한 솔루션

이 스타일 라인 .aspx페이지 (또는 .css사용 가능한 경우 링크 된 파일)에 삽입

#reportViewer_ctl09 {
  overflow:visible !important;
 }

이유

Chrome과 Safari overflow:auto는 IE와 관련하여 다른 방식으로 렌더링 됩니다.

SSRS HTML은 QuirksMode HTML이며 IE 5.5 버그에 의존합니다. IE가 아닌 브라우저에는 IE quirksmode가 없으므로 HTML을 올바르게 렌더링합니다.

SSRS 2008 R2 보고서에서 생성 된 HTML 페이지 div에는 overflow:auto스타일 있는이 포함되어 있으며 보고서를 보이지 않는 보고서로 변환합니다.

<div id="ctl31_ctl10" style="height:100%;width:100%;overflow:auto;position:relative;">

Chrome의 Dev Tools ( )를 사용하여 제작 된 웹 페이지에서 수동으로 변경 overflow:auto하여 Chrome에 대한 보고서를 볼 수 있습니다 .overflow:visibleF12


나는 Tim의 솔루션을 좋아 하며 쉽고 작동합니다.

그러나 여전히 문제가 있습니다. 사용자가 매개 변수를 변경할 때마다 (내 보고서는 매개 변수를 사용합니다!) AJAX가 div를 새로 고치면 overflow : auto 태그가 다시 작성되고 스크립트가 변경되지 않습니다.

이 기술 노트 세부 사항 은 문제점에 대해 설명합니다.

이는 AJAX 패널로 빌드 된 페이지에서 전체 페이지를 새로 고치지 않고 AJAX 패널 만 상태를 변경하기 때문에 발생합니다. 따라서 태그에 OnLoad적용한 이벤트 <body>는 페이지가 처음로드 될 때 한 번만 실행됩니다. 그 후에 AJAX 패널을 변경해도 더 이상 이러한 이벤트가 트리거되지 않습니다.

사용자 einarq 가이 솔루션을 제안 했습니다 .

또 다른 옵션은 함수의 이름을 pageLoad로 바꾸는 것입니다. 이 이름을 가진 모든 함수는 페이지에 존재하는 경우 asp.net ajax에 의해 자동으로 호출되며 각 부분 업데이트 이후에도 호출됩니다. 이렇게하면 body 태그에서 onload 속성을 제거 할 수도 있습니다.

그래서 솔루션에 표시된 개선 된 스크립트를 작성했습니다.


SizeToReportContent="true"아래와 같이 포함하십시오.

<rsweb:ReportViewer ID="ReportViewer1" runat="server" SizeToReportContent="True"...

SQL 2008 R2 SP1과 함께 Chrome 버전 21을 사용하고 있으며 위의 수정 사항 중 어느 것도 저에게 효과가 없습니다. 아래는 다른 답변과 마찬가지로 "C : \ Program Files \ Microsoft SQL Server \ MSRS10_50.MSSQLSERVER \ Reporting Services \ ReportManager \ js \ ReportingServices.js"에이 코드를 추가했습니다 . SSRS 서버) :

//Fix to allow Chrome to display SSRS Reports
function pageLoad() { 
    var element = document.getElementById("ctl31_ctl09");
    if (element) 
    {
        element.style.overflow = "visible";         
    } 
}

이것은 알려진 문제 입니다. 문제는 div 태그에 "overflow : auto"스타일이 있다는 것입니다. 이는 분명히 Safari 및 Chrome에서 사용되는 WebKit에서 잘 구현되지 않습니다 (Emanuele Greco의 답변 참조). RS : ReportViewerHost 요소를 사용하라는 Emanuele의 제안을 활용하는 방법을 몰랐지만 JavaScript를 사용하여 해결했습니다.

문제

여기에 이미지 설명 입력

해결책

Since "overflow: auto" is specified in the style attribute of the div element with id "ctl31_ctl10", we can't override it in a stylesheet file so I resorted to JavaScript. I appended the following code to "C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager\js\ReportingServices.js"

function FixSafari()
{    
    var element = document.getElementById("ctl31_ctl10");
    if (element) 
    {
        element.style.overflow = "visible";  //default overflow value
    }
}

// Code from http://stackoverflow.com/questions/9434/how-do-i-add-an-additional-window-onload-event-in-javascript
if (window.addEventListener) // W3C standard
{
    window.addEventListener('load', FixSafari, false); // NB **not** 'onload'
} 
else if (window.attachEvent) // Microsoft
{
    window.attachEvent('onload', FixSafari);
}

Note

There appears to be a solution for SSRS 2005 that I have not tried but I don't think it is applicable to SSRS 2008 because I can't find the "DocMapAndReportFrame" class.


My solution based on the ideas above.

function pageLoad() {
    var element = document.querySelector('table[id*=_fixedTable] > tbody > tr:last-child > td:last-child > div');
    if (element) {
        element.style.overflow = "visible";
    } 
}

It's not limited to a certain id plus you don't need to include any other library such as jQuery.


Here is the solution I used for Report Server 2008 R2

It should work regardless of what the Report Server will output for use for in its "id" attribute of the table. I don't think you can always assume it will be "ctl31_fixedTable"

I used a mix of the suggestion above and some ways to dynamically load jquery libraries into a page from javascript file found here

On the server go to the directory: C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager\js

Copy the jquery library jquery-1.6.2.min.js into the directory

Create a backup copy of the file ReportingServices.js Edit the file. And append this to the bottom of it:

var jQueryScriptOutputted = false;
function initJQuery() {

    //if the jQuery object isn't available
    if (typeof(jQuery) == 'undefined') {


        if (! jQueryScriptOutputted) {
            //only output the script once..
            jQueryScriptOutputted = true;

            //output the script 
            document.write("<scr" + "ipt type=\"text/javascript\" src=\"../js/jquery-1.6.2.min.js\"></scr" + "ipt>");
         }
        setTimeout("initJQuery()", 50);
    } else {

        $(function() {     

        // Bug-fix on Chrome and Safari etc (webkit)
        if ($.browser.webkit) {

            // Start timer to make sure overflow is set to visible
             setInterval(function () {
                var div = $('table[id*=_fixedTable] > tbody > tr:last > td:last > div')

                div.css('overflow', 'visible');
            }, 1000);
        }

        });
    }        
}

initJQuery();

You can fix this easily with jQuery - and a little ugly hack :-)

I have a asp.net page with a ReportViewer user control.

 <rsweb:ReportViewer ID="ReportViewer1" runat="server"...

In the document ready event I then start a timer and look for the element which needs the overflow fix (as previous posts):

 <script type="text/javascript">
    $(function () {
        // Bug-fix on Chrome and Safari etc (webkit)
        if ($.browser.webkit) {
            // Start timer to make sure overflow is set to visible
             setInterval(function () {
                var div = $('#<%=ReportViewer1.ClientID %>_fixedTable > tbody > tr:last > td:last > div')
                div.css('overflow', 'visible');
            }, 1000);
        }
    });
</script>

Better than assuming it has a certain id. You can adjust the timer to whatever you like. I set it to 1000 ms here.


FYI - none of the above worked for me in 2012 SP1...simple solution was to embed credentials in the shared data source and then tell Safari to trust the SSRS server site. Then it worked great! Took days chasing down supposed solutions like above only to find out integrated security won't work reliably on Safari - you have to mess with the keychain on the mac and then still wouldn't work reliably.


The solution provided by Emanuele worked for me. I could see the report when I accessed it directly from the server but when I used a ReportViewer control on my aspx page, I was unable to see the report. Upon inspecting the rendered HTML, I found a div by the id "ReportViewerGeneral_ctl09" (ReportViewerGeneral is the server id of the report viewer control) which had it's overflow property set to auto.

<div id="ReportViewerGeneral_ctl09" style="height: 100%; width: 100%; overflow: auto; position: relative; ">...</div>

I used the procedure explained by Emanuele to change this to visible as follows:

function pageLoad() {
    var element = document.getElementById("ReportViewerGeneral_ctl09");

    if (element) {
        element.style.overflow = "visible";
    }
}

I've used this. Add a script reference to jquery on the Report.aspx page. Use the following to link up JQuery to the microsoft events. Used a little bit of Eric's suggestion for setting the overflow.

$(document).ready(function () {
    if (navigator.userAgent.toLowerCase().indexOf("webkit") >= 0) {        
        Sys.Application.add_init(function () {
            var prm = Sys.WebForms.PageRequestManager.getInstance();
            if (!prm.get_isInAsyncPostBack()) {
                prm.add_endRequest(function () {
                    var divs = $('table[id*=_fixedTable] > tbody > tr:last > td:last > div')
                    divs.each(function (idx, element) {
                        $(element).css('overflow', 'visible');
                    });
                });
            }
        });
    }
});

참고 URL : https://stackoverflow.com/questions/5968082/ssrs-2008-r2-ssrs-2012-reportviewer-reports-are-blank-in-safari-and-chrome

반응형