【问题标题】:SSRS Report Viewer Control Browser CompatibilitySSRS 报告查看器控制浏览器兼容性
【发布时间】:2010-10-10 10:27:31
【问题描述】:

MS Report Viewer Control 与 Firefox 和 Safari 等浏览器的兼容性如何?

如果您认识任何 SSRS 的第三方报告查看器,也请发布。

【问题讨论】:

    标签: reporting-services


    【解决方案1】:

    编辑 - 2016/2017 更新

    SSRS 2016+可以说是跨浏览器兼容的。
    表格边框在 IE10 中无法正确显示,但 IE10 无论如何都会消失。
    在其他浏览器中,这很好。

    您仍然需要注册add_pageLoaded来翻译参数提示。

    Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function () { fixReportingServices('rpt-container'); });
    

    此外,与 PageCountMode="Actual" 添加到 RS:ReportViewerHost 控件。

    <RS:ReportViewerHost ID="ReportViewerControl" PageCountMode="Actual" runat="server" />
    

    如果你想有有意义的寻呼号码。

    此外,使用日期选择器在查询字符串中设置语言时会出现问题(SSRS context.Request.UserLanguages[i] 设置为 HTTP 模块中 context.BeginRequest 中查询字符串中指定的语言。

    此外,如果您想在 Internet 的 iframe 中安全地使用 SSRS,则需要在每个 HTTP 响应中添加 X-Frame-Options 和 Content-Security-Policy HTTP 标头。见my github-repository for details

    </EndEdit>
    

    2016 年之前:

    我可以告诉你,我有 9 年的经验(SSRS 2005、SSRS 2008 R1 & R2、2012 和 SSRS 2014)。

    让我向您保证,由于 SSRS HTML 报告依赖于 IE5-Quirksmode,因此它们绝对不可能在 Internet Explorer 以外的任何浏览器中正确呈现(我可能倾向于添加 IE

    如果您对报表服务器具有管理员访问权限,并且我强调 IF,您可以在 ReportViewer 页面上添加 jQuery 例程和 CSS 来纠正最基本的问题(例如您看不到超过 1 厘米的报表) ,但除此之外,HTML 呈现看起来仍然非常糟糕(边距、表格边框、图片填充、列大小、文本字段大小、标题和/或页码对齐等,简而言之 - 几乎任何东西)

    当然,ActiveX 打印机控件只能在 InternetExplorer(Windows 上)中工作,因为只有 ActiveX 支持。

    我也向你保证,绝对没有办法让 ReportManager 在 IE 以外的任何其他浏览器中工作。

    关于 Internet Explorer 支持,应该提到的是,从 IE 版本 10 开始,IE 默认为 webkit-quirksmode(出于兼容性原因)而不是 IE5 quirksmode,因此呈现的 HTML 看起来与 Chrome/ IE 10+ 的 Firefox/Safari,除非您在 ReportViewer.aspx 页面中添加了与 meta xua 兼容的 IE5。

    后者可能不适用于 Intranet,因为 IE 在 Intranet 站点上时会自动回退到 IE 7 兼容模式(但仅限于任何 Windows 版本)。

    在 Windows 8 中,localhost 链接和计算机名链接(无法在 stackoverflow 帖子中添加 http://)未分配到本地 Intranet 区域(可能是快速破解,因此 IE 不会回退到 IE7 兼容模式),因此,Windows 身份验证将失败。

    还应该提到的是,不能为 ReportManager 添加与 meta xua 兼容的 IE5,因为没有可以编辑的页面(已编译的不可更新的 ASP.NET 网站项目...)。
    而且由于没有使用开发工具在 quirksmode 中切换 reportmanager,因此无法在 IE 10+ 中使用 ReportManager。

    然后,还有一点要提的是,从 IE9 开始,IE 从父页面继承 iframe 元素的 doctype,而且也没有办法更改它(无需将父页面更改为所需的子页面-page 文档模式)。

    因此,如果您足够聪明地使用 iframe 生成报告,因为在弹出窗口拦截器时代,任何理智的人都不会想要弹出窗口,因此报告页面将继承父页面的文档类型。如果这不是 IE5-QuirksMode,它将使报告与 Safari/Chrome/Firefox/Opera 上的任何 IE > 8 一样可怕,无论 ReportViewer.aspx 中是否存在任何可能的 meta xua 兼容 ie5 标记。

    至于替代品,免费且具有类似功能集,只有 Eclipse BIRT(幸运的是,HTML 呈现不相似)。

    应该提到的是,BIRT 虽然根据 Eclipse 公共许可证获得许可,但使用 SUN Java,因此您使用的是 Oracle 技术,该技术受其各自许可条款的约束。
    此外,您使用的是非 Microsoft 技术,而 Excel-Sheets BIRT 呈现实际上是 XML 文件,在 Office 2010+ 中打开时会产生(谁会猜到)相当惊人的警告。

    然后,收取相当大的费用,有http://www.stimulsoft.com 报告和 Telerik 报告。
    从技术的角度来看,我推荐 stimulsoft 报告,但是:免责声明,我没有使用过其中任何一个,因为它们不是免费的。

    至于替代 SSRS 渲染引擎(不是查看器,顺便说一句),只有 www.fyireporting.com/‎,这里有一个 fork http://www.codeproject.com/Articles/138271/An-Open-Source-RDL-Engine

    但是 fyiReporting 不完整并且正在进行中(如果没有放弃的话),所以我会避免使用它。


    底线,如果您的产品仅是 IE 和 Windows,Windows 版本 对于其他任何事情,请使用 stimulsoft 报告(问题是,您必须重做所有报告,因为没有自动迁移 - 甚至不是非工作报告)。

    PS:
    通过添加“一点 javascript”,我的意思是以下内容(2008 R1 版,不适用于 2008R2+,可能适用于 2005,并注意您需要将 jQuery 和 jQuery Migrate 嵌入到 inline-script 标签中,如果客户端 PC 无权访问 http(s)://ajax.aspnetcdn.com [注意:将脚本放入 Pages 文件夹并添加相对或绝对链接不起作用...]):

    <%@ Register TagPrefix="RS" Namespace="Microsoft.ReportingServices.WebServer" Assembly="ReportingServicesWebServer" %>
    <%@ Page Language="C#" AutoEventWireup="true" Inherits="Microsoft.ReportingServices.WebServer.ReportViewerPage" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    
    <%= System.Web.HttpContext.Current.Request.Browser.Browser == "IE" && System.Globalization.CultureInfo.InvariantCulture.CompareInfo.IndexOf(System.Convert.ToString(System.Web.HttpContext.Current.Request.QueryString), "stylesheet", System.Globalization.CompareOptions.IgnoreCase) == -1 ? (System.Web.HttpContext.Current.Request.Browser.Browser != "IE" ? "": "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=5\">") : "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">" %>
    
        <head id="headID" runat="server">
        <title>Report Viewer</title>
    
    
    
    
        <script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js"></script>
        <script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/jquery.migrate/jquery-migrate-1.1.0.min.js"></script>
    
    
    
        <script type="text/javascript">
    
            var bInFrameOrIframe = false;
            var iLanguageIndex = 0;
            var language = "DE_LOL";
            var UpdateLock = false;
    
    
    
            if (window.self === window.top) {
                // alert("true");
                // not in a frame 
                // Use IE5 quirksmode 
                //document.writeln('<meta http-equiv="X-UA-Compatible" content="IE=5" />');
                bInFrameOrIframe = false
            }
            else {
                // in a frame, FMS
                bInFrameOrIframe = true;
            }
    
    
            function TranslateParameterPrompts() {
    
                //mTo = false;
                $("table[id^='ParametersGridReportViewerControl'] span").each(function(index) {
                    var strText = $(this).text();
                    if (strText != null && strText.indexOf('/') != -1) {
                        strText = strText.split('/');
                        if (iLanguageIndex < strText.length)
                            strText = strText[iLanguageIndex];
                        else {
                            if (strText.length > 0)
                                strText = strText[0];
                        }
    
                        $(this).text(strText);
                    }
    
                });
    
                //setTimeout(function(){mTo = true}, 5000);
            }
    
    
            function setTableSize() {
                //$("[id$='ReportViewerControl']")
                $(
                    $(
                        $("#ReportFrameReportViewerControl")[0].contentWindow.document
                    )
                    .find("[id$='report']")[0].contentWindow.document.body
                ).find('*')
                .each(function() {
                    //console.log("Processing an element");
                //var cls = $(this).attr("class");
    
                try {
    
                        // Don't add a border to sort-arrow
                        if ($(this).is('img')) {
                            return;
                        }
    
    
                        var anywidth = $(this).css('width');
                        var anywidth = parseFloat(anywidth);
                        //console.log("anywidth: " + anywidth);
    
    
                        //var lol = $(this).css('borderLeftWidth');
                        var blw = $(this).css('border-left-width');
                        var brw = $(this).css('border-right-width');
                        var btw = $(this).css('border-top-width');
                        var bbw = $(this).css('border-bottom-width');
    
                        var borls = $(this).css('border-left-style') == "solid";
                        var borrs = $(this).css('border-right-style') == "solid";
                        var borts = $(this).css('border-top-style') == "solid";
                        var borbs = $(this).css('border-bottom-style') == "solid";
    
    
    
                        var blw = parseFloat(blw);
                        var brw = parseFloat(brw);
                        var btw = parseFloat(btw);
                        var bbw = parseFloat(bbw);
    
                        //parseInt($(this).css("borderRightWidth"))
                        //console.log(parseInt($(this).css("borderLeftWidth")));
    
                        UpdateLock = true;
    
    
                        // Set width to 1px where 0px
                        if (anywidth == 0)
                            $(this).css('width', '1px');
    
    
                        if (borls && blw == 0.0 || (blw > 0.0 && blw < 1.0)) {
                            //console.log("setting border width");
                            $(this).css('border-left-width', '1px');
                        }
    
                        if (borrs && brw == 0.0 || (brw > 0.0 && brw < 1.0)) {
                            $(this).css('border-right-width', '1px');
                        }
    
                        if (borts && btw == 0.0 || (btw > 0.0 && btw < 1.0)) {
                            $(this).css('border-top-width', '1px');
                        }
    
                        if (borbs && bbw == 0.0 || (bbw > 0.0 && bbw < 1.0)) {
                            $(this).css('border-bottom-width', '1px');
                        }
    
                        UpdateLock = false;
                    }
                    catch (ex) {
                        UpdateLock = false;
                        //console.log(ex);
                    }
    
                });             // End $('*').each
    
                // console.log("loop");
    
    
    
    
                var $img = $("img[onload^='this.fitproportional=true']");
                if ($img == null) {
                    // console.log("img is null");
                    return;
                }
                var $div = $img.parent();
                if ($div == null) {
                    // console.log("div is null");
                    return;
                }
    
                UpdateLock = true;
                {
                    $img.removeAttr("height");
                    $img.css('max-width', '100%')
                    $img.css('max-height', '100%')
    
                    $div.css('text-align', 'right');
    
                    var divMinWidth = parseFloat($div.css('min-width'));
                    var divWidth = parseFloat($div.css('width'));
    
                    var divMinHeight = parseFloat($div.css('min-height'));
                    var divHeight = parseFloat($div.css('height'));
    
                    // console.log("width: " + divWidth);
                    // console.log("height: " + divHeight);
                    // console.log("min-width: " + divMinWidth);
                    // console.log("min-height: " + divMinHeight);
    
                    if (divMinWidth != 0)
                        $div.css('width', $div.css('min-width'));
    
                    if (divMinHeight != 0)
                        $div.css('height', $div.css('min-height'));
    
                }
                UpdateLock = false;
    
            }
    
    
            $(document).ready(function() {
    
                switch (language) {
                    case "fr":
                        iLanguageIndex = 1;
                        break;
                    case "it":
                        iLanguageIndex = 2;
                        break;
                    case "en":
                        iLanguageIndex = 3;
                        break;
                    default: // "DE" 
                        iLanguageIndex = 0;
                }
    
                TranslateParameterPrompts();
                // setInterval(function() { TranslateParameterPrompts() }, 100);
    
    
                if ($.browser.msie && !bInFrameOrIframe)
                    return;
    
                // if ($.browser.webkit)
                //setTableSize();
    
                $("[id$='ReportFrameReportViewerControl']").load(function() {
                    //setNewHeight();
                    //alert("Loading");
    
                    setTableSize();
    
                    $(
                        $("[id$='ReportFrameReportViewerControl']")[0].contentWindow.document
                    )
                    .find("[id$='report']").load(function() {
                        //alert("load report");
                        setTableSize();
                    }
                    ); // End load #report
    
                }); // End Function load #ReportFrameReportViewerControl
    
            });    // End Function document.ready
    
        </script>
    
    </head>
    <body style="margin: 0px; overflow: auto">
        <form style="width:100%;height:100%" runat="server" ID="ReportViewerForm">
            <RS:ReportViewerHost ID="ReportViewerControl" runat="server" />
        </form>
    </body>
    </html>
    

    注意:UpdateLock 源于 2012 年的 backport,此处并未真正使用,语言也源于 backport,2012 年需要设置 TranslateParameterPrompts 上的 setInterval 和功能 对于 2012 年,在 jQuery 选择器中只添加了一点“标签”...

        function TranslateParameterPrompts() {
    
            //mTo = false;
            $("table[id^='ParametersGridReportViewerControl'] label span").each(function(index) {
                var strText = $(this).text();
                if (strText != null && strText.indexOf('/') != -1) {
                    strText = strText.split('/');
                    if (iLanguageIndex < strText.length)
                        strText = strText[iLanguageIndex];
                    else 
                    { 
                        if(strText.length > 0)
                            strText = strText[0];
                    }
    
                    $(this).text(strText);
                }
    
            });
    
            //setTimeout(function(){mTo = true}, 5000);
        }
    

    从浏览器语言推断语言是这样的,顺便说一句:

    <script type="text/javascript">
        language = <%= System.Web.HttpContext.Current.Request.UserLanguages != null ? "\"" + System.Convert.ToString(System.Web.HttpContext.Current.Request.UserLanguages[0]) + "\"" : "null" %>;
    
        if(language == null)
            language = window.navigator.userLanguage || window.navigator.language;
    
        if(language != null)
            language = language.substr(0,2).toLowerCase();
    
    </script>
    

    并且在 2012 年您需要 Dispose 会话 cookie,否则在打开大约 120 个报告后您会得到“HTTP 400: Header too long”:

    <script type="text/C#" runat="server">
    protected string ClearSessionKeepAliveCookiesToPreventHttp400HeaderTooLong()
    {
        if(Request == null || Request.Cookies == null)
            return "";
    
        if(Request.Cookies.Count < 60)
            return "";
    
        // System.Web.HttpContext.Current.Response.Write("<h1>"+Request.Cookies.Count.ToString()+"</h1>");
        for(int i = 0; i < System.Web.HttpContext.Current.Request.Cookies.Count; ++i)
        {
            if(StringComparer.OrdinalIgnoreCase.Equals(Request.Cookies[i].Name, System.Web.Security.FormsAuthentication.FormsCookieName))
                continue;
    
            if(!Request.Cookies[i].Name.EndsWith("_SKA", System.StringComparison.OrdinalIgnoreCase))
                continue;
    
            if(i > 60)
                break;
    
            //System.Web.HttpContext.Current.Response.Write("<h1>"+Request.Cookies[i].Name+"</h1>");
    
            System.Web.HttpCookie c = new System.Web.HttpCookie( Request.Cookies[i].Name );
            //c.Expires = System.DateTime.Now.AddDays( -1 );
            c.Expires = new System.DateTime(1970, 1 ,1);
            c.Path = Request.ApplicationPath + "/Pages";
            c.Secure = false;
            c.HttpOnly = true;
    
            // http://stackoverflow.com/questions/5517273/httpcookiecollection-add-vs-httpcookiecollection-set-does-the-request-cookies
            //Response.Cookies[Request.Cookies[i].Name] = c;
            //Response.Cookies.Add(c);
            Response.Cookies.Set(c);
        }
    
        return "";
    }
    
    
    </script>
    

    而在2012年,你需要收听内容更新,因为它使用了微软的Ajax控件

    function cbOnContentUpdate() {
        //console.log("content update");
        alterTableBorderWidth();
        // TranslateParameterPrompts();
    } // End Callback cbOnContentUpdate
    
    
    var hLastTimeout = null;
    
    function queueUpdate() {
    
        if (UpdateLock)
            return;
    
    
        if (hLastTimeout != null)
            clearTimeout(hLastTimeout);
    
        hLastTimeout = window.setTimeout(function() { cbOnContentUpdate(); }, 50);
    
        //window.setTimeout(function() { cbOnContentUpdate(); }, 3000);
    } // End Function queueUpdate
    
    
    $(document).ready(function() {
    
        switch (language) {
            case "fr":
                iLanguageIndex = 1;
                break;
            case "it":
                iLanguageIndex = 2;
                break;
            case "en":
                iLanguageIndex = 3;
                break;
            default: // "DE" 
                iLanguageIndex = 0;
        }
    
        setInterval(function() { TranslateParameterPrompts() }, 100);
    
        // opt-out for non-framed IE, because that crook supports IE5-Quirks (framed takes parent-doctype in IE >= 9)
        if ($.browser.msie && !areWeInFrame())
            return;
    
    
        // if ($.browser.webkit)
    
        // console.log('Setting event listener!');
    
        // http://stackoverflow.com/questions/4979738/fire-jquery-event-on-div-change
        //$("[id$='ReportViewerControl']").bind('DOMNodeInserted DOMNodeRemoved', function(event) {
        //$("[id$='ReportArea']")
        $("body")
         .bind('DOMNodeInserted DOMNodeRemoved DOMSubtreeModified', function(event) {
    
             if (event.type == 'DOMNodeInserted') {
                 //console.log('Content added! Current content:' + '\n\n' + this.innerHTML);
                 //console.log('Content added!');
                 queueUpdate();
             }
             else {
                 //console.log('Content removed! Current content:' + '\n\n' + this.innerHTML);
                 //console.log('Content removed!');
                 queueUpdate();
             }
         }); // End Bind IRM
    
    });   // End Function $(document).ready
    

    请注意,对于 2012 年,setTableSize 是 alterTableBorderWidth,选择器如下所示:

     function alterTableBorderWidth() 
            {
                //$('*')
                $("[id$='ReportViewerControl']").find('*')
                .each(function() {
    

    顺便说一句,如果你想删除 PRINT 图标,因为它只是一个悲伤的来源,就像这样(德语、英语、法语和意大利语 [瑞士使用的语言 + 英语])。

    这个CSS是针对2008 R1的,不知道2012是否一样。

    input[type="image"][title="Drucken"], input[type="image"][title="Print"], input[type="image"][title="Imprimer"], input[type="image"][title="Stampa"]
    {
        display: none !important;
    }
    

    如果这仍然不能阻止您,那么继续并在 SSRS 2012 中使用表单身份验证(提示 1:没有 ms-provied 示例,如 2005-2008R2,您需要自己编写);)

    提示 2:如果您遵循提示 1,当 URL [错误?] 中有冒号时,表单身份验证重定向不起作用,您可以从 mono 中窃取代码并编写自己的重定向。

    提示 3:如果您遵循提示 2 并获得表单身份验证工作,那么您可能想要更改您要编写的上传工具,因为您不喜欢手动执行“为每个报告浏览目录 - 检查允许覆盖复选框 - 上传报告 - 设置数据源)为 120 个左右的报告,那么您将从 ReportingService2005 继承一个类并覆盖 GetWebRequest 和 GetWebResponse

    ''' <summary>
    ''' Overriding the method defined in the base class.
    ''' </summary>
    ''' <param name="uri"></param>
    ''' <returns></returns>
    Protected Overrides Function GetWebRequest(uri As Uri) As System.Net.WebRequest
        Dim request As System.Net.HttpWebRequest
        request = DirectCast(System.Net.HttpWebRequest.Create(uri), System.Net.HttpWebRequest)
        request.Credentials = MyBase.Credentials
        request.CookieContainer = New System.Net.CookieContainer()
    
        If m_authCookie IsNot Nothing Then
            request.CookieContainer.Add(m_authCookie)
        End If
    
        Return request
    End Function ' GetWebRequest 
    
    
    
    ''' <summary>
    ''' Overriding the method defined in the base class.
    ''' </summary>
    ''' <param name="request"></param>
    ''' <returns></returns>
    Protected Overrides Function GetWebResponse(request As System.Net.WebRequest) As System.Net.WebResponse
        Dim response As System.Net.WebResponse = MyBase.GetWebResponse(request)
    
        ' http://social.msdn.microsoft.com/Forums/sqlserver/en-US/f68c3f2f-c498-4566-8ba4-ffd5070b8f7f/problem-with-ssrs-forms-authentication
        Dim cookieName As String = response.Headers("RSAuthenticationHeader")
        If cookieName IsNot Nothing Then
            m_authCookieName = cookieName
            Dim webResponse As System.Net.HttpWebResponse = DirectCast(response, System.Net.HttpWebResponse)
            Dim authCookie As System.Net.Cookie = webResponse.Cookies(cookieName)
    
            ' Save it for future reference and use.
            m_authCookie = authCookie
        End If
    
        Return response
    End Function ' GetWebResponse 
    

    提示 4:如果您尚未在 SSRS 2008 R2 上安装 Service Pack 1 + 2,则上述方法将不起作用...

    提示 5:存在 TranslateParameters 方法是因为您无法(按设计)通过 SSRS 将参数提示翻译成多种语言,因此您编写:

    Raum / Local / Locale / Room 
    

    使用架构:

    Text_DE / Text_FR / Text_IT / Text_EN
    

    然后在文本上用“/”分割(如果提示文本在某处包含“/”,这很容易出错),然后通过选择 MIN(splitarray.长度,索引)顺便说一句,以防万一您只有 Text_DE / Text_FR 或其他什么,当然首先检查文本是否包含“/”。

    提示 6: 我需要继续吗? (我仍然可以将这篇文章扩大到十倍,但我想我现在应该回去工作了:))

    如果您想看看它的外观如何,这就是原版 ssrs 在 chrome 中的呈现方式

    这是它在 IE11 中的样子,通过 xua 设置 IE5 兼容性

    这就是它应该的样子,你可以通过大量修改 javascript 和 CSS 来渲染它

    附录:
    哦,它变得更好了

    如果您想以应用程序指定的语言(与浏览器语言不同)运行 reportviewer,则需要将 reportviewer 的文化设置为查询字符串中指定的文化...

    <script type="text/C#" runat="server">
        protected override void InitializeCulture()
        {
            string sprache = System.Web.HttpContext.Current.Request.QueryString["in_sprache"];
    
            // System.Web.HttpContext.Current.Response.Write(sprache);
    
            switch(System.Globalization.CultureInfo.InvariantCulture.TextInfo.ToLower(sprache))
            {
                case "fr":
                    sprache = "fr-CH";
                    break;
                case "it":
                    sprache = "it-CH";
                    break;
                case "en":
                    sprache = "en-US";
                    break;
                default:
                    sprache = "de-CH";
                    break;
            }
    
            // System.Web.HttpContext.Current.Response.Write(sprache);
    
            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture(sprache);
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(sprache);
            base.InitializeCulture();
        }
    
    
    
    </script>
    

    如果要设置静态文化,可以在页面声明中进行

    <%@ Page UICulture="de" Culture="de-CH" %>
    

    如果您尝试删除打印图标和 atom-feed,使用样式进行操作,无论如何,它仅适用于 Chrome...

        input[type="image"][title="Drucken"], input[type="image"][title="Print"],    input[type="image"][title="Imprimer"], input[type="image"][title="Stampa"]
        {
            display: none !important;
        }
    
    
        input[type="image"][title="In Datenfeed exportieren"], input[type="image"][title="Exporter vers un flux de données"], input[type="image"][title="Esporta in feed di dati"], input[type="image"][title="Export to Data Feed"]
        {
            display: none !important;
        }
        */
        input[type="image"][src$="Microsoft.Reporting.WebForms.Icons.Print.gif"] {
            display: none !important;
        }
    
        input[type="image"][src$="Microsoft.Reporting.WebForms.Icons.AtomDataFeed.gif"] {
            display: none !important;
        }
    

    但实际上,您至少可以通过将ShowPrintButton="false" 添加到reportviewer 控件来删除Internet-explorer 中的打印图标:

    <RS:ReportViewerHost ID="ReportViewerControl" ShowPrintButton="false" runat="server" />
    

    另一个想法:在 SSRS 2012 和 2014(可能还有 2008R2)中,您还可以将修复 SSRS 的 javaScript 方法添加到 ScriptManager 的 add_pageLoaded 中。像这样:

    Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function () { fixReportingServices('rpt-container'); });
    

    那么您就不必监听页面更改事件,这会加快速度,因为在每次更新结束时,loaded 只会被调用一次。

    警告

    因为在互联网上,IE不默认兼容视图,

    <meta http-equiv="X-UA-Compatible" content="IE=5">
    

    也不会帮助您解决某些问题(rotate270 文本/垂直文本)。

    即使在 IE 中,它也只有在内网时才能正常工作,因为只有这样它才会使用“兼容性视图”。虽然元标记将浏览器设置为 IE5-Quirksmode,但它并没有启用“兼容性视图”,所以它不是真正的 quirksmode...

    【讨论】:

    • tl;dr 版本 - 它不是很兼容。非常彻底的答案。
    • +1 获取所有信息! (IE5-Quirks 模式万岁!)
    • 即使在 VS 2015 (Viewer v12) 中,如果您想查看打印链接或缩放控件,您也需要使用 IE 11(不是 Edge 或 Chrome 等)。但总的来说,我在这个控件上从来没有遇到过很多问题。然而,最近,我确实希望其他人能做出更好的网络 SSRS 报告查看器控件。它现在很容易成为 SQL Server 2014 中最薄弱的环节。
    【解决方案2】:

    MS Report Viewer Control 只能在 IE 中正常工作。 您可以从其他浏览器查看报告,但无法查看缩放选项

    【讨论】:

    • 缩放选项将是您遇到的最少问题。
    【解决方案3】:

    有关浏览器兼容性和 ReportViewer 控件的信息,请参阅以下 MSDN 文章:

    【讨论】:

      【解决方案4】:

      我没有注意到它在 Firefox 或 Safari 中显示的任何实际问题。有时我认为它在 Firefox 中可能会变得更好,但我没有任何实际的基准来支持这一点。

      【讨论】:

      • 你瞎了吗?表格边框、垂直文本(旋转 270)、图像对齐、文本字段(表格中没有的任何内容)、边框宽度等......您可以使用 3 个不同版本的 Internet Explorer,并获得 3 个不同的结果。跨度>
      【解决方案5】:

      从臀部开始,也许有点陈旧。 ASP.NET 曾经将任何非 IE 浏览器视为一盒石头。如果您遇到问题,可能值得研究。

      http://weblogs.asp.net/fmarguerie/archive/2005/01/04/346222.aspx

      【讨论】:

        【解决方案6】:

        SSRS 在 IE6、7、8 上完美运行。它适用于 Firefox 和 Safari,但显示问题。

        有两种可能的解决方案来解决这些问题,测试并查看适合您的方案。

        解决方案 1

        前往

        C:\Program Files\Microsoft SQL Server\MSSQL.(您的报表服务器 实例)\报告 服务\ReportServer\Pages\reportviewer.aspx

        更新样式为

        <body style="margin: 0px; overflow: auto"> ... <RS:ReportViewerHost style="display:table;" ID="ReportViewerControl" runat="server" />
        

        解决方案 2

        向样式表添加以下更改:

        .DocMapAndReportFrame { 最小高度:660px;最小宽度:1280px; }
        .MenuBarBkGnd { min-width:1000px; }

        【讨论】:

        • 引用:“SSRS 在 IE6、7、8 上完美运行”。是的,但不是在 IE 9、10 和 11 中……还有理智的人还在使用 IE
        【解决方案7】:

        Firefox、Chrome 和 Safari 存在渲染问题。我知道对于 Firefox 和 Chrome,有一些 IE 插件可以让您在 Firefox/Chrome 选项卡中运行报告。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2014-01-27
          • 1970-01-01
          • 1970-01-01
          • 2018-11-25
          • 2012-10-19
          • 2012-08-09
          相关资源
          最近更新 更多