How to build multilingual Crystal reports

后端 未结 3 2043
眼角桃花
眼角桃花 2021-01-21 16:11

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.

I

相关标签:
3条回答
  • 2021-01-21 16:18

    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.

      Report folder structure

    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

    0 讨论(0)
  • 2021-01-21 16:23

    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

    0 讨论(0)
  • 2021-01-21 16:38

    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.

    0 讨论(0)
提交回复
热议问题