问题
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:
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.
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
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