How to build multilingual Crystal reports

孤街醉人 提交于 2019-12-20 03:02:25

问题


We are developing a multilingual Winforms application using visual studio 2008. I am trying to figure out how I can create multilingual reports using crystal Reports.

Is there any thing similar to .net resource files in the Crystal reports world?


回答1:


I'm sorry that I'm robbing you of your tumbleweed badge, but I don't think Crystal has the multiple language support similar to .NET. I think that your only option is to have a separate report for each language and pass the data into the report in the language that you wish to display.

Here is a link of a similar answer. http://www.dbforums.com/crystal-reports/991737-crystal-report-multillingual-support.html




回答2:


This would be a manual way of doing this:

  1. Create a report for each language you want and put into the proper folders structure. i.e. all japanese reports will go into rpt_ja/ folder.

  2. Use .Net Resource file to specify report resource name and full resource name for each language:

    • resource.resx

      RPT_SAMPLE -> report01.rpt

      RPT_SAMPLE_FULL -> MyCompany.NameSpace.Reports.Report01.rpt

    • resource.ja.resx

      RPT_SAMPLE -> rpt_ja\report01.ja.rpt

      RPT_SAMPLE_FULL -> MyCompany.NameSpace.Reports.Report01.ja.rpt

  3. Then use this value in the report code file: Open the report .cs file and change:

    public override string ResourceName {
    get {
        // Change this to HttpContext.GetGlobalResourceObject("Resource", "RPT_SAMPLE").ToString();
        return "report01.rpt";
    }
    set {
        // Do nothing
    }
    

    }

    public override string FullResourceName {
        get {
            // Change this to HttpContext.GetGlobalResourceObject("Resource", "RPT_SAMPLE_FULL").ToString();
            return "rpt_ja\report01.ja.rpt";
        }
        set {
            // Do nothing
        }
    }
    

EDIT: HttpContext is for ASP.Net web application. In winform, you can try Properties.Resources.ResourceManager.GetString() to get the string from resources




回答3:


A client ask me for a solution to this issue. I developed a solution based on Crystal Reports contentLocale keyword and Custom Functions. See my posting: http://www.cogniza.com/blog/?p=55.



来源:https://stackoverflow.com/questions/1037751/how-to-build-multilingual-crystal-reports

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!