Culture of Report

Stimulsoft Reports.NET discussion
Post Reply
semtec
Posts: 21
Joined: Wed Oct 29, 2008 2:41 am
Location: Rotterdam

Culture of Report

Post by semtec »

Hello,

I have a question about setting a report's culture for displaying the correct decimal-format.
This format should be according to the Dutch-culture (nl-NL). After instantiating a StiReport, the AutoLocalizeReportOnRun property is set to true, which tells the report to use the culture of the system it is operating on, right? But due to problems with our database-backend we have to set the Thread.CurrentThread.CurrentCulture to en-US every time we access the database. So, to overcome this problem I need to set the Thread.CurrentThread.CurrentCulture to nl-NL just before the reports takes over this culture due to the AutoLocalizeReportOnRun property. How can I do this? Is there an event for this?

Regards,

René
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Culture of Report

Post by Edward »

Hi René,
semtec wrote:But due to problems with our database-backend we have to set the Thread.CurrentThread.CurrentCulture to en-US every time we access the database.
Could you please explain these problems you have with database access?

Here is the code which helps to localize the preview and designer:

Code: Select all

Stimulsoft.Report.StiConfig.Load();
//Here you could specify the folder with localization files:
//Stimulsoft.Report.StiOptions.Configuration.DirectoryLocalization = ...;
Stimulsoft.Report.StiOptions.Configuration.SearchLocalizationFromRegistry = false;
Stimulsoft.Report.StiConfig.LoadLocalization("en.xml");
Stimulsoft.Report.StiOptions.Configuration.Localization = "en.xml";
Stimulsoft.Report.StiConfig.Save();
AutoLocalizeReportOnRun function will help you when you are using 'Globalization' feature of the report and you have some cultures 'inside' of the report, please see
'C:\Program Files\Stimulsoft Reports.Net 2008.2 Trial\Samples\C#\GlobalizedReport\' sample project for more details.

Thank you.
semtec
Posts: 21
Joined: Wed Oct 29, 2008 2:41 am
Location: Rotterdam

Culture of Report

Post by semtec »

Hi Edward,
Edward wrote:Could you please explain these problems you have with database access?
When we use the nl-NL culture, the dataprovider for our database (informix) returns decimals multiplied by 1000. This is a bug in the Informix.Net provider, which won't be solved for long. There is a workaround, that's to set the Thread.CurrentThread.CurrentCulture to en-US every time we do a CRUD-operation.

Now, I don't need to localize the report for translation purposes. I just need to manually set the system's Thread.CurrentThread.CurrentCulture to nl-NL in a way that, when the report is shown, printed or designed, it has that specific culture. Keep in mind that at report.RegData, the database is hit, and the culture will be set to en-US!

I hope you understand this problem.

Regards,
René
semtec
Posts: 21
Joined: Wed Oct 29, 2008 2:41 am
Location: Rotterdam

Culture of Report

Post by semtec »

Hi Edward,

Don't bother this problem anymore. We have solved it with a workaround.

Regards,

René ;)
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Culture of Report

Post by Edward »

Hi René,

Thank you for this information.

Good luck! :)

Let us know if we can help you somehow.

Thank you.
Post Reply