Do any of you know if it's possible, and how, one can set a report viewer's report language programmatically?
For example, something like this:
var reportviewer = new ReportViewer();
reportViewer.LocalReport.Language = CultureInfo.CurrentUICulture;
Or more specifically, if it's possible to set the report language to a custom culture and how?
Not that this is particularly for ReportViewer, but if you are creating a localreport programatically (.rdlc), there is no need to change the users culture. Open the rdlc report and in the Report's properties set the 'Language' property to a Parameter of your choice e.g.
=Parameters!ReportLanguage.Value
You cannot set this property to a dataset field unfortunately (at least not in Visual Studio 2013)
In the ReportData screen (Ctrl + ALT + D), Create a parameter called 'ReportLanguage'. You only need to set the name, you don't need to add any extra details.
In a textbox on your report, set a FormatCurrency expression
=FormatCurrency(Fields!UnitPrice.Value, 2)
This will format the currency of the textbox value to whatever the Language of the report is (to 2 decimal places)
Now in the code generating the report (C#), set the ReportLanguage parameter
LocalReport localReport = new LocalReport();
localReport.ReportPath = pathToMyRdlcFile;
localReport.SetParameters(new ReportParameter("ReportLanguage", "en-GB"));
"en-GB" will give you a pound sign when the report is generated, but you can get a euro symbol by using "fr-FR" or similar.
Indeed you could replace the hardcoded "en-GB" with a function.
Hope this helps.