Writing Code
 Crystal Reports Forum : Crystal Reports .NET 2003 : Writing Code
Message Icon Topic: Getting the chart titles with C# Post Reply Post New Topic
Author Message
AlexanderF
Newbie
Newbie


Joined: 16 Feb 2010
Location: Austria
Online Status: Offline
Posts: 2
Quote AlexanderF Replybullet Topic: Getting the chart titles with C#
    Posted: 16 Feb 2010 at 3:03am
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
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.