Safari 和 Chrome 中的报告为空白

发布于 2024-11-06 08:20:27 字数 264 浏览 0 评论 0原文

我将我们的报告服务从版本 2008 迁移到另一个服务器版本 2008 R2。在 2008 版本中,报告在 Safari 上运行良好。新版本2008 R2 报告根本不显示。我看到的只是参数部分,然后报告是空白的。在 Chrome 中也是如此。根据 Microsoft 的说法,如果以有限的方式支持 Safari。报告并不复杂。事实上,我创建了一个报告,上面只有一行,看看它是否会显示在 Safari 中,但不会,该报告也是完全空白的。有人让 SSRS 报告可以在 Safari 上查看吗?我是否必须搞乱某种配置设置?

I migrated our reporting services from version 2008 to another server version 2008 R2. In version 2008 the reports work fine on Safari. The new version 2008 R2 the reports do not show up at all. All I see is the parameter section and then the report is blank. Same in Chrome. According to Microsoft Safari IS supported if in a limited fashion. The reports are not complex. In fact I created a report that only had a line on it to see if it would show up in Safari but no, that report is completely blank as well. Did anyone make SSRS reports viewable on Safari? Do I have to mess with some kind of a configuration setting?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

绅刃 2024-11-13 08:20:27

最终解决方案(也适用于 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< /code> 以不同的方式尊重 IE。

SSRS HTML 是 QuirksMode HTML,依赖于 IE 5.5 错误。非 IE 浏览器没有 IE 怪异模式,因此可以正确呈现 HTML

SSRS 2008 R2 报告生成的 HTML 页面包含一个具有 overflow:auto 样式的 div,它将报告变成了无形的报告。

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

我可以通过使用 Chrome 开发工具 (F12) 在生成的网页中手动将 overflow:auto 更改为 overflow:visible 来查看 Chrome 上的报告。


我喜欢蒂姆的解决方案 ,它既简单又有效。

但仍然存在一个问题:每当用户更改参数(我的报告使用参数!)AJAX 刷新 div 时,overflow:auto 标记就会被重写,并且没有脚本会更改它。

此技术说明详细信息解释了问题所在:

发生这种情况是因为在使用 AJAX 面板构建的页面中,只有 AJAX 面板会更改其状态,而不会刷新整个页面。因此,您在 标记上应用的 OnLoad 事件仅触发一次:页面第一次加载时。此后,更改任何 AJAX 面板将不再触发这些事件。

用户 einarq 建议此解决方案

另一个选项是将函数重命名为 pageLoad。任何具有此名称的函数都将被 asp.net ajax 自动调用(如果该函数存在于页面上),并且在每次部分更新之后也是如此。如果这样做,您还可以从 body 标记中删除 onload 属性

因此编写了解决方案中显示的改进脚本。

Ultimate solution (works in SSRS 2012 too!)

Append the following script to the following file (on the SSRS Server)
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"; 
    }
}

Note: As azzlak noted, the div's name isn't always ctl31_ctl10. For SQL 2012 tryctl32_ctl09 and for 2008 R2 try ctl31_ctl09. If this solution doesn't work, look at the HTML from your browser to see if the script has worked properly changing the overflow:auto property to overflow:visible.


Solution for ReportViewer control

Insert into .aspx page (or into a linked .css file, if available) this style line

#reportViewer_ctl09 {
  overflow:visible !important;
 }

Reason

Chrome and Safari render overflow:auto in different way respect to IE.

SSRS HTML is QuirksMode HTML and depends on IE 5.5 bugs. Non-IE browsers don't have the IE quirksmode and therefore render the HTML correctly

The HTML page produced by SSRS 2008 R2 reports contain a div which has overflow:auto style, and it turns report into an invisible report.

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

I can see reports on Chrome by manually changing overflow:auto to overflow:visible in the produced webpage using Chrome's Dev Tools (F12).


I love Tim's solution, it's easy and working.

But there is still a problem: any time the user change parameters (my reports use parameters!) AJAX refreshes the div, the overflow:auto tag is rewritten, and no script changes it.

This technote detail explains what is the problem:

This happens because in a page built with AJAX panels, only the AJAX panels change their state, without refreshing the whole page. Consequently, the OnLoad events you applied on the <body> tag are only fired once: the first time your page loads. After that, changing any of the AJAX panels will not trigger these events anymore.

User einarq suggested this solution:

Another option is to rename your function to pageLoad. Any functions with this name will be called automatically by asp.net ajax if it exists on the page, also after each partial update. If you do this you can also remove the onload attribute from the body tag

So wrote the improved script that is shown in the solution.

情独悲 2024-11-13 08:20:27

只需包含 SizeToReportContent="true" ,如下所示

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

Just include SizeToReportContent="true" as shown below

<rsweb:ReportViewer ID="ReportViewer1" runat="server" SizeToReportContent="True"...
左秋 2024-11-13 08:20:27

我使用的是 Chrome 版本 21 和 SQL 2008 R2 SP1,以上修复均对我不起作用。下面是有效的代码,与其他答案一样,我将这段代码添加到 Append to "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";         
    } 
}

I am using Chrome version 21 with SQL 2008 R2 SP1 and none of the above fixes worked for me. Below is the code that did work, as with the other answers I added this bit of code to Append to "C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager\js\ReportingServices.js" (on the SSRS Server) :

//Fix to allow Chrome to display SSRS Reports
function pageLoad() { 
    var element = document.getElementById("ctl31_ctl09");
    if (element) 
    {
        element.style.overflow = "visible";         
    } 
}
草莓味的萝莉 2024-11-13 08:20:27

这是 已知问题。问题是 div 标签的样式为“overflow: auto”,显然这种样式在 Safari 和 Chrome 使用的 WebKit 中没有很好地实现(参见 Emanuele Greco 的回答)。我不知道如何利用 Emanuele 的建议来使用 RS:ReportViewerHost 元素,但我使用 JavaScript 解决了它。

问题

在此处输入图像描述

解决方案

由于“溢出:自动”在 ID 为“ctl31_ctl10”的 div 元素的 style 属性中指定,我们无法在样式表文件中覆盖它,因此我求助于 JavaScript。我将以下代码附加到“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);
}

注意

似乎有一个 解决方案对于SSRS 2005,我没有尝试过,但我认为它不适用于SSRS 2008,因为我找不到“Doc​​MapAndReportFrame”类。

This is a known issue. The problem is that a div tag has the style "overflow: auto" which apparently is not implemented well with WebKit which is used by Safari and Chrome (see Emanuele Greco's answer). I did not know how to take advantage of Emanuele's suggestion to use the RS:ReportViewerHost element, but I solved it using JavaScript.

Problem

enter image description here

Solution

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.

酒中人 2024-11-13 08:20:27

我的解决方案基于上述想法。

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

它不限于某个 id,而且您不需要包含任何其他库,例如 jQuery。

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.

娇女薄笑 2024-11-13 08:20:27

这是我用于 Report Server 2008 R2 的解决方案,

无论 Report Server 将输出什么内容以用于表的“id”属性,它都应该有效。我不认为你总是可以假设它会是“ctl31_fixedTable”

我混合使用了上面的建议和一些方法来从找到的javascript文件将jquery库动态加载到页面中 此处

在服务器上转到目录:
C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager\js

将 jquery 库 jquery-1.6.2.min.js 复制到目录中

创建文件 ReportingServices.js 的备份副本
编辑文件。并将其附加到其底部:

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();

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();
甜扑 2024-11-13 08:20:27

您可以使用 jQuery 轻松修复此问题 - 以及一些丑陋的 hack :-)

我有一个带有 ReportViewer 用户控件的 asp.net 页面。

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

在文档就绪事件中,我然后启动一个计时器并查找需要溢出修复的元素(如之前的帖子):

 <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>

比假设它具有特定的 id 更好。
您可以根据自己的喜好调整计时器。我这里设置为1000毫秒。

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.

探春 2024-11-13 08:20:27

仅供参考 - 上述内容在 2012 SP1 中都对我不起作用...简单的解决方案是将凭据嵌入共享数据源,然后告诉 Safari 信任 SSRS 服务器站点。然后效果很好!花了几天时间寻找像上面这样的所谓解决方案,结果发现集成安全性在 Safari 上无法可靠地工作 - 你必须弄乱 mac 上的钥匙串,然后仍然无法可靠地工作。

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.

逐鹿 2024-11-13 08:20:27

埃马努埃莱提供的解决方案对我有用。当我直接从服务器访问该报告时,我可以看到该报告,但是当我在 aspx 页面上使用 ReportViewer 控件时,我无法看到该报告。检查渲染的 HTML 后,我发现了一个 ID 为“ReportViewerGeneral_ctl09”的 div(ReportViewerGeneral 是报表查看器控件的服务器 ID),其溢出属性设置为 auto。

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

我使用 Emanuele 解释的过程将其更改为可见,如下所示:

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

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

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";
    }
}
憧憬巴黎街头的黎明 2024-11-13 08:20:27

我用过这个。在 Report.aspx 页面上添加对 jquery 的脚本引用。使用以下命令将 JQuery 链接到 microsoft 事件。使用了埃里克的一些建议来设置溢出。

$(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');
                    });
                });
            }
        });
    }
});

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');
                    });
                });
            }
        });
    }
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文