• 网站发布在中文操作系统,但ReportViewer的工具栏显示为英文的解决方法


    转:http://www.cnblogs.com/emanlee/archive/2009/08/31/1557365.html

    打包的时候加上 Microsoft.ReportViewer.WebForms.resources.dll 这个文件即可

    http://www.cnblogs.com/Jasmin/archive/2007/01/11/617470.html

    微软提供的ReportViewer扩展接口里有个叫IReportViewerMessages的,用它来设置你的中文信息即可。

    怎样对reportView 工具栏上, 进行语言设置呀,
    我也装了中文包了,
    我想设置成中文, 帮忙!!
    多谢!!
    这个跟你的客户端的IE设置有关,在IE中的General选项中,Lanaguage选项,设置中文优先的话,这样你的Reportviewer显示的中文.

    公司最近一个项目,用到了打印功能,报表服务器为SQL2005的Reporting   Services,其中数据库服务器、web服务器操作系统、.Net2.0   Framework都是英文版。
    因此出现了一个问题,客户端浏览器在查看报表的时候,报表信息是中文,但是报表上面的工具栏确是英文的。
    尝试了装.net2   Framework中文语言包、ReportView中文语言包、程序中采用中文属 性(AssemblyInfo.cs文件中设置[assembly:   NeutralResourcesLanguageAttribute( "zh-CN ")])、安装windows最新补丁等方法,都没有办法实现。最后在msdn看到了Microsoft.Reporting.WebForms中一个接 口IReportViewerMessages的介绍:使应用程序可以提供自定义的用户界面消息。因此尝试用实现此接口的方法来实现。
    在App_Code目录下新建ReportViewerMessagesZhcn.cs类,让他实现IReportViewerMessages接口,代码如下:
    using   System;
    using   System.Collections.Generic;
    using   System.Text;
    using   Microsoft.Reporting.WebForms;
    namespace   AdminConsole.App_Code
    {
            public   class   ReportViewerMessagesZhcn   :   IReportViewerMessages
            {
                    #region   IReportViewerMessages   Members
                    public   string   BackButtonToolTip
                    {
                            get   {   return   ( "后退 ");   }
                    }
                    public   string   ChangeCredentialsText
                    {
                            get   {   return   ( "更改 ");   }
                    }
                    public   string   ChangeCredentialsToolTip
                    {
                            get   {   return   ( "ChangeCredentialsToolTip. ");   }
                    }
                    public   string   CurrentPageTextBoxToolTip
                    {
                            get   {   return   ( "当前页 ");   }
                    }
                    public   string   DocumentMap
                    {
                            get   {   return   ( "文档视图 ");   }
                    }
                    public   string   DocumentMapButtonToolTip
                    {
                            get   {   return   ( "文档视图. ");   }
                    }
                    public   string   ExportButtonText
                    {
                            get   {   return   ( "导出 ");   }
                    }
                    public   string   ExportButtonToolTip
                    {
                            get   {   return   ( "导出 ");   }
                    }
                    public   string   ExportFormatsToolTip
                    {
                            get   {   return   ( "选择格式. ");   }
                    }
                    public   string   FalseValueText
                    {
                            get   {   return   ( "不正确的值. ");   }
                    }
                    public   string   FindButtonText
                    {
                            get   {   return   ( "查找 ");   }
                    }
                    public   string   FindButtonToolTip
                    {
                            get   {   return   ( "查找 ");   }
                    }
                    public   string   FindNextButtonText
                    {
                            get   {   return   ( "下一个 ");   }
                    }
                    public   string   FindNextButtonToolTip
                    {
                            get   {   return   ( "查找下一个 ");   }
                    }
                    public   string   FirstPageButtonToolTip
                    {
                            get   {   return   ( "第一页 ");   }
                    }
                    public   string   InvalidPageNumber
                    {
                            get   {   return   ( "页面数不对 ");   }
                    }
                    public   string   LastPageButtonToolTip
                    {
                            get   {   return   ( "最后一页 ");   }
                    }
                    public   string   NextPageButtonToolTip
                    {
                            get   {   return   ( "下一页 ");   }
                    }
                    public   string   NoMoreMatches
                    {
                            get   {   return   ( "无匹配项 ");   }
                    }
                    public   string   NullCheckBoxText
                    {
                            get   {   return   ( "空值 ");   }
                    }
                    public   string   NullValueText
                    {
                            get   {   return   ( "空值 ");   }
                    }
                    public   string   PageOf
                    {
                            get   {   return   ( "页 ");   }
                    }
                    public   string   ParameterAreaButtonToolTip
                    {
                            get   {   return   ( "参数设置 ");   }
                    }
                    public   string   PasswordPrompt
                    {
                            get   {   return   ( "PasswordPrompt ");   }
                    }
                    public   string   PreviousPageButtonToolTip
                    {
                            get   {   return   ( "上一页 ");   }
                    }
                    public   string   PrintButtonToolTip
                    {
                            get   {   return   ( "打印 ");   }
                    }
                    public   string   ProgressText
                    {
                            get   {   return   ( "正在生成报表...... ");   }
                    }
                    public   string   RefreshButtonToolTip
                    {
                            get   {   return   ( "刷新 ");   }
                    }
                    public   string   SearchTextBoxToolTip
                    {
                            get   {   return   ( "查找 ");   }
                    }
                    public   string   SelectAValue
                    {
                            get   {   return   ( "SelectAValue ");   }
                    }
                    public   string   SelectAll
                    {
                            get   {   return   ( "全选 ");   }
                    }
                    public   string   SelectFormat
                    {
                            get   {   return   ( "选择格式 ");   }
                    }
                    public   string   TextNotFound
                    {
                            get   {   return   ( "未找到 ");   }
                    }
                    public   string   TodayIs
                    {
                            get   {   return   ( "TodayIs ");   }
                    }
                    public   string   TrueValueText
                    {
                            get   {   return   ( "TrueValueText ");   }
                    }
                    public   string   UserNamePrompt
                    {
                            get   {   return   ( "UserNamePrompt ");   }
                    }
                    public   string   ViewReportButtonText
                    {
                            get   {   return   ( "查看报表 ");   }
                    }
                    public   string   ZoomControlToolTip
                    {
                            get   {   return   ( "缩放 ");   }
                    }
                    public   string   ZoomToPageWidth
                    {
                            get   {   return   ( "页宽 ");   }
                    }
                    public   string   ZoomToWholePage
                    {
                            get   {   return   ( "整页 ");   }
                    }
                    #endregion
            }
    }
    最后在web.config中设置该类对ReportViewer的控制:
    在   <appSettings>   节中添加   ReportViewerMessages   属性,代码如下:
    <appSettings>
            <add   key= "ReportViewerMessages "   value= "AdminConsole.App_Code.ReportViewerMessagesZhcn,App_Code "   />
      </appSettings>

    <add key="ReportViewerServerConnection" value="MyNamespace.MyClass, MyAssembly"/>

       MSDN: http://msdn.microsoft.com/en-us/library/ms251661%28v=vs.80%29.aspx


    附:、

       reportviewer报表在fireFox中无法根据报表宽度自动设置自身宽度解决办法 :

       (http://stackoverflow.com/questions/949165/report-viewer-width-problem-in-mozila)

      添加 css

       <styletype="text/css">
        html
    , body, form
       
    {
           
    width:100%;
           
    height:100%;
           
    margin:0;
           
    padding:0;
       
    }
        table
    #rptvReport
       
    {
           
    display: table !important;
           
    background-color:White;
           
    min-height:500px;
       
    }
    </style>

  • 相关阅读:
    Apache Commons介绍(转载)
    MYSQL Nested Join Optimization
    Mysql Nested-Loop Join Algorithms
    jquery eval解析JSON中的注意点介绍
    jspSmartUpload上传下载使用例子
    JavaWeb基础
    (一)Model的产生及处理
    SpringMVC注解@RequestParam全面解析
    @ModelAttribute使用详解
    Spring中Controller和RequestMapping的详解
  • 原文地址:https://www.cnblogs.com/junkai/p/2473543.html
Copyright © 2020-2023  润新知