In ActiveReports, you can localize settings for the Windows Forms Viewer control by modifying a provided "strings" text file, generating a resources file, embedding the resources file in your ActiveReports project and adding the localization code needed in your Windows Form Load event.
Making localization changes to the strings text file
To make changes to the text file
- Click here to open the text file in your browser.
- Right-click on the text and select "View Source."
- This will open the file in Notepad. Make changes to localize settings for the viewer control.
- From the File menu, select Save As. Rename your text file "localization.txt" and save it to the location of your choice.
Generating the resources file from the text file
To generate the resources file
- Open a Visual Studio .NET 2003 or 2005 command prompt.
- Change the prompt path to reflect the location of your localization.txt file.
- Type "resgen localization.txt localization.resources. "
- This creates a resources file in the same location as the text file.
Adding the resources file to your Windows application
To add the resources file
- Open your ActiveReports Windows application which includes an ActiveReports Windows Forms Viewer control.
- In the Solution Explorer window, click on the icon to "Show All Files."
- Right-click on the name of your project and click Add > Add Existing Item.
- Select the appropriate file path to the localization.resources file and click Open.
- This adds the resources file to your application.
Adding code to the Windows Form Load event
To write the code for the viewer in Visual Basic and C#
- Double-click the title bar of the Windows Form to create an event-handling method for the Form_Load event.
The following example shows what the code for the method looks like.
'Visual Basic Private Sub myForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles MyBase.Load Dim res As New ResourceManager("YourProjectName.localization", Me.GetType() _ .Assembly) Me.Viewer1.Localize = res Dim rpt As New rptLocalize() Viewer1.Document = rpt.Document rpt.Run(True) End Sub //C# private void myForm_Load(object sender, System.EventArgs e) { ResourceManager res = new ResourceManager("YourProjectName.localization", this.GetType().Assembly); this.viewer1.Localize = res; rptLocalize rpt = new rptLocalize(); viewer1.Document = rpt.Document; rpt.Run(true); }