Você está na página 1de 1

HOWTO: Dynamically Localizing ActiveReports - GrapeCity http://www.datadynamics.com/forums/94547/PrintPost.

aspx

KnowledgeBase for ActiveReports for .NET

HOWTO: Dynamically Localizing ActiveReports

09-27-2006, 4:14 PM

With ActiveReports for .NET 3.0, you can easily localize a report by manipulating several properties of the report. To see a simple use
of this, please follow the steps below.

1. Create a new Windows application and add a new ActiveReports 3.0 file to the project.
2. Add a textbox to the detail section, change the name to txtInfo and set the Text property to English Report.
3. Select the ActiveReport and change the Localizable property to True in the Properties grid.
4. Click on the Language property and select the language to which you want to localize. French was selected for the purposes of
this example.
5. Select txtInfo again and set the Text property to French Report. A new .resx file, '<report name>.fr.resx' is created.
6. Click on the Language property and set its value back to English. The text of txtInfo should change back to "English Report."
7. Add two buttons and an ActiveReports Viewer control to your Windows Form. Change the name of the buttons to btnEnglish
and btnFrench and set the Text property of each to the language they are to display.
8. andto your Windows Form.select the language to which you want to localize. French was selected for the purposes of this
example.
9. Double-click the buttons to create an event-handling method for each button. Add code to set the culture info to the appropriate
culture, create the report object and set the document of the viewer to the document of the report.
C#
private void btnFrench_Click(object sender, EventArgs e)
{
//Set the current threads culture info to french
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("Fr");
//create the report object
localization rpt = new localization();
//run the report
rpt.Run();
//link the viewer to the report document
this.viewer1.Document = rpt.Document;
}

private void btnEnglish_Click(object sender, EventArgs e)


{
//Set the current threads culture info to french
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("En");
//create the report object
localization rpt = new localization();
//run the report
rpt.Run();
//link the viewer to the report document
this.viewer1.Document = rpt.Document;
}

10. To see the effects, run the report and click each button.

The attached .zip file contains a sample project and a Word document that contains the above information with accompanying images
for instructional purposes.

1 of 1 03/05/2011 20:32

Você também pode gostar