How to Pass Culture to the Telerik Reporting REST Service from the Report Viewer
Environment
Product | Progress® Telerik® Reporting |
Report Viewers | HTML5-based, WPF, WinForms |
Description
The reports are rendered with the culture of the REST Service. If you need to request a report with specific culture from the Report Viewer, you may use the following approaches.
Solution
WPF and WinForms Report Viewers
You may pass the culture to the Telerik Reporting REST Service in the RenderingBegin event of the WPF/Winforms Viewer. The argument Telerik.ReportViewer.Common.RenderingBeginEventArgs args has a DeviceInfo property, where you may set the new culture with a code like:
private void ReportViewer1_RenderingBegin(object sender, Telerik.ReportViewer.Common.RenderingBeginEventArgs args)
{
string culture = "yourCulture";
args.DeviceInfo["CurrentCulture"] = culture;
args.DeviceInfo["CurrentUICulture"] = culture;
}
HTML5-based Report Viewers
The HTML5-based report viewers also have a renderingBegin(e, args) event with second argument(args) that has a deviceInfo propery that may be used to pass the culture to the report. For example:
renderingBegin(e, { deviceInfo }) {
const culture = "yourCulture"
deviceInfo["CurrentCulture"] = culture;
deviceInfo["CurrentUICulture"] = culture;
}
Notes
You need to have the Report localized for the corresponding "yourCulture".
Another approach you may use is through a custom User Function - see the article section Centralizing the localization of reports for details.