alansiqueira27
alansiqueira27

Reputation: 8506

How can I set Report Viewer language the same as CultureInfo.CurrentUICulture?

As I understood, by default, the language of report viewer is set by "CultureInfo.InstalledUICulture" (not that simple). That means, if my computer is from Brazil, then it will format numbers with Brazil's culture. Altought my data may be formatted with United States' culture, so my report viewer display things incorrectly. I guess one solution to solve it, is by changing the language of the report viewer as the same of my CultureInfo.CurrentUICulture.

How can I achieve that in the simplest way, please?

Upvotes: 1

Views: 4875

Answers (2)

user6314158
user6314158

Reputation: 139

There are two (+1) separate things here:

  1. The language of the controls, tooltips, etc. inside the ReportViewer control. This depends on the System.Threading.Thread.CurrentThread.CurrentUICulture.

  2. The number, date, currency, etc. formats within the report. These are controlled by changing the Language property of the rdlc file in use.

  3. The actual content of the report which is controlled via your DataSource(s). This one is pretty obvious, but I mentioned it for sake of completeness.

Upvotes: 0

Andres A.
Andres A.

Reputation: 1349

In the report properties set the Language property as:

=System.Threading.Thread.CurrentThread.CurrentUICulture.ToString()

Or to whatever you need. I'm using a report parameter for example. The value must resolve to a string.

You can access the report properties via the properties window, and then from the top list select "Report". Or you could simply click in the gray area of the report, and press F4.

Example.

Upvotes: 4

Related Questions