How to build multilingual Crystal reports

后端 未结 3 2171
眼角桃花
眼角桃花 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

提交回复
热议问题