|
Hello!
I have some reports which should be prepared for multilingual support. While searching the different solution paths, I found the following code line:
((TextObject)ReportDocument.ReportDefinition.Sections["YourSection"].ReportObjects["YourField"]).Text = myResourceText
I created a function which reads out the elements of a given report and writes the name and the text of the element into a resx file. If the report object is not a TextObject and no FieldHeading, the name and the type of the object are written into the resx file.
private void LoadReportLanguageResources(ReportDocument report, string resourceFilePath) { ResXResourceWriter resXWriter = new ResXResourceWriter(resourceFilePath); //set the language values of the report - find all fields and sections
foreach (ReportObject reportObject in report.ReportDefinition.ReportObjects) { if ( reportObject.Kind == ReportObjectKind.TextObject || reportObject.Kind == ReportObjectKind.FieldHeadingObject) { resXWriter.AddResource(reportObject.Name, ((TextObject)reportObject).Text); } else { resXWriter.AddResource(reportObject.Name, reportObject.ToString()); } }
resXWriter.Close(); resXWriter.Dispose(); }
I have the following objects included in the report: Engine.BoxObject Engine.ChartObject Engine.CrossTabObject Engine.FieldObject Engine.PictureObject
As my Charts contain titles and legends, I need to translate the content of those elements. Does anybody know how I could access those values via C#?
Thank you for your advice. Alex
|