Converting VCL/FMX and ActiveX templates to .NET.

Over the years, a number of TeeChart users have asked how to convert the charts they created either using TeeChart VCL/FMX or ActiveX to the .NET version, enabling them to more easily port their previously created charting projects to .NET.

Well, this is possible! It might not be the ideal or perfect solution but it’s an approximation that can save you some work. This can be achieved in two ways:

  1. Using the TeeToTen application. It is a .NET application that uses TeeChart ActiveX to load the .tee files (TeeChart VCL/FMX and ActiveX templates), convert them to text files, generate an XML file with series and data and then load them into a .NET chart  which is then used to generate the .ten file (TeeChart .NET templates) file. The tool comes with a readme.txt document that explains which are its prerequisites and how to use it. TeeToTen tool can also be called via command line with several parameter options. This way it can be called from your applications to obtain a completely automatic conversion. Full details on how to use it are available at included readme.txt.
  2. This solution by-passes the ActiveX version and uses TeeToText, a small VCL application that loads .tee files and generates the necessary text and XML files. Actually, anybody that uses TeeChart VCL/FMX or TeeChart ActiveX can easily generate such files using their built in exporting functionalty, which is what TeeToText does. Once the process is complete,  you need to use TenCreator.dll included with TeeToTen  to import these generated files into your .NET chart. Here’s an example of TenCreator.dll being used to convert one file:
string chartFile = @"C:\temp\TemplateSamples\Annotations.txt";
string dataFile = @"C:\temp\TemplateSamples\Annotations.xml";

TenCreator.TenStreamer streamer = new TenCreator.TenStreamer();
System.IO.Stream netStream = streamer.ConvertFile(chartFile, dataFile);
netStream.Position = 0;
tChart1.Import.Template.Load(netStream);
tChart1.Export.Template.Save(@"C:\TemplateSamples\Annotations.ten");

and here’s an example converting a complete folder:

public Form1()
{
    InitializeComponent();
    InitializeChart();
}

private void InitializeChart()
{
    DirectoryInfo dFolder = new DirectoryInfo(@"C:\TemplateSamples");
    SearchOption so = new SearchOption();
    bool incSubDirectories = false;

    if (incSubDirectories)
    {
        so = SearchOption.AllDirectories;
    }
    else
    {
        so = SearchOption.TopDirectoryOnly;
    }

    FileInfo[] fFileArray = dFolder.GetFiles("*.tee", so);

    foreach (FileInfo fFile in fFileArray)
    {
        ConvertFile(fFile.FullName);
    }
}

private void ConvertFile(string fileName)
{
    string chartFile = fileName.Replace(".tee", ".txt");
    string dataFile = fileName.Replace(".tee", ".xml");

    TenCreator.TenStreamer streamer = new TenCreator.TenStreamer();
    Stream netStream = streamer.ConvertFile(chartFile, dataFile);
    netStream.Position = 0;
    tChart1.Import.Template.Load(netStream);
    tChart1.Export.Template.Save(fileName.Replace(".tee", ".ten"));
}

This project is a work in progress. It’s being improved upon user demand so feel free to let us know your feedback at info at steema dot com.  We hope this helps in the transition of your existing projects that use TeeChart to the .NET platform.