The technical articles cover a range of survey topics related to various features of Stimulsoft Reports. Interesting and useful tips, hints, how-tos, code snippets etc.

Erasing Borders

Published on 09 April 2013

Share this post

Many years ago people spoke a single language, and, by all appearances, it was beautiful time. Just imagine the world, where all people understand each other, without restrictions and misunderstanding, easy and free… Since building of the Tower of Babel people attempted many times to create a universal mean of communication, but we all know the result - notorious language barrier still has not been overcome.

The same problems people meet every day in many areas. And reporting is no exception. Often companies, organizations and institutions need in creating one report in different languages. How can you translate the report content into all required languages, and, what is very important, to do this quickly and with minimum costs? We have got an answer. We always have got an answer.

There are two solutions of this problem. You can create many separate reports for each language or one report with the ability to automatically translate it into the required languages.

When creating separate reports you can flexibly customize them considering specifics of languages. But, besides this way is time- and money-consuming, if you need to change some data in reports, you will have to do this step by step in each versions of the reports for each language.

There are two ways of creating reports with the ability to automatically translate it into required languages. They are creating reports in the designer using the GlobalizationEditor and from code, using the resource file.

For the first way we have created the editor Globalization Strings. It shows all report strings, which can be translated. You can add required cultures and specify translation of strings for each of these cultures. By default, for all cultures, all strings match report values and change when modifying the report. But if you set a new value for a string, this value will be stored and will not change itself.

You can call the Globalization Strings from the Property Grid. The context menu of the Property Grid should be set to Professional.

In the latest release we have added two new buttons, which make your work with editor easier. The function Get Culture Settings allows filling the current culture in the editor with report values, in other words, all values, which you earlier entered for this culture, will be substituted with report values. The function Set Culture Settings allows applying the customized culture to the current report, during report designing.

In order to globalize the report from code you need to make 3 steps:

Set the Globalized Name for all components, which must be changed. There are, for example, Text, TextInCells, RichText, and Image. In Visual Studio we create resource file for each culture with applied GlobalizedName and values of components. The values of components are translation of component texts or images.

Create the GlobalizationManager with the description of all fields.

The second step is the description of the class GlobalizationManager, which example you can see in the project delivered with the installation pack of the product (you may find it in the folder Samples). After this, in the source code, the GlobalizationManager will be created indicating the culture that will be used for the translation.

Page {PageNumber} of {TotalPageCount}

3. After we know, what language we need, we create GlobalizationManager and assign it to the report, load the report, and all values will be substituted.

report.GlobalizationManager = new GlobalizationManager("GlobalizedReport.MyResources", new CultureInfo(cultureName));

With Stimulsoft reporting tools you will never have any language barriers. Try it and make sure.