This article is targeting to .net developer whom they are dealing with crystal reports.
Generally we are working multi language supported application where we are using resource file to fetch value different language and they are loaded in UI based on users culture.
But this structure is not working in crystal reports. In crystal reports generally we are filling all data from database but what about headers and title information, if client requires that all available in based on selected language.
So for this handle we need to fill each text objects in crystal reports. So we have to provided appropriate name of all headers and title related text object in rtp file.
Below are the code for find that find and update all objects.
ReportClass reortptH = new ReportClass(); rptH.FileName = Server.MapPath("~/Reports/ReportData.rpt"); reortptH.Load(); TextObject EmployeeName = (TextObject)reortptH.ReportDefinition.ReportObjects["hdEmployeeName"]; EmployeeName.Text = ResourceManager.GetObject(“EmployeeName”); // EmployeeName is resource key TextObject Department = (TextObject)reortptH.ReportDefinition.ReportObjects["hdDepartment"]; Department.Text = ResourceManager.GetObject(“Department”); // Department is resource key //……Need to update all text objects with resource key value. reortptH.Refresh();
So in this way we can update available header and title related static information reports by value from resource file. We can create a report in multi-language supported.
Please add comments if you have any suggestion/questions.
Thanks,
Amit Patel
amitpatel.it@gmail.com
“Enjoy Programming”
