Page 1 of 1

Bad headers in series exported to Excel format - TeeChart502

Posted: Mon Oct 11, 2004 8:33 am
by 5894817
I have got insufficient column headers when exporting
series data to Excel format.


My computer software configuration is:

- MS Windows 2000 5.00.2195 Service Pack 4
- Borland Delphi Enterprise 6.0 (Build 6.240) Update Pack 2
- TeeChart Pro 5.02


1. I have test program with following code:

-----------------------------------------------------
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, TeEngine, Series, ExtCtrls, TeeProcs, Chart, TeeEdit;

type
TForm1 = class(TForm)
Chart1: TChart;
Series1: TLineSeries;
Series2: TLineSeries;
Series3: TLineSeries;
MainMenu1: TMainMenu;
miChartEditor: TMenuItem;
ChartEditor1: TChartEditor;
procedure miChartEditorClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation
{$R *.dfm}

procedure TForm1.miChartEditorClick(Sender: TObject);
begin
with ChartEditor1 do begin
Chart := self.Chart1; Execute;
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
i: integer;
begin
with Chart1 do
for i := 0 to SeriesCount-1 do begin
Series.Title := Chr( Ord('A')+Ord(i) );
Series.FillSampleValues(3);
end;
end;

end.
-----------------------------------------------------

2. The results of series data export to XML format are:

-----------------------------------------------------
<?xml version="1.0" ?>
<chart>
<series title="A" type="Line">
<points count="3">
<point Y="570"/>
<point Y="497"/>
<point Y="508"/>
</points>
</series>

<series title="B" type="Line">
<points count="3">
<point Y="545"/>
<point Y="538"/>
<point Y="545"/>
</points>
</series>

<series title="C" type="Line">
<points count="3">
<point Y="518"/>
<point Y="517"/>
<point Y="524"/>
</points>
</series>

</chart>
-----------------------------------------------------

3. The results of series data export to Excel format and when
exported from Excel to text format are:

-----------------------------------------------------
Y Y Y
570 545 518
497 538 517
508 545 524
-----------------------------------------------------

So all column headers are "Y".

What can I do to solve this problem?

Posted: Mon Oct 11, 2004 9:58 am
by Pep
Hi,

the export code gets it's column names from series XValues.Name ,YValues.Name and some global variables like TeeMsg_Text. In your case, the following code will do what you need:

Code: Select all

Uses TeeConst, TeeStore;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.Clear;
  Series1.Add(10,'1st');
  Series1.Add(3,'2nd');
  Series1.Add(6,'3rd');
  Series1.YValues.Name := 'CustomBarName';
  TeeMsg_Text := 'CustomTextName';

  with TSeriesDataXLS.Create(Chart1,nil) do
  try
    IncludeHeader := True;
    IncludeLabels := True;
    SaveToFile('d:\temp\test.xls');
  finally
    Free;
  end;
end;

Export to Excel from Chart Editor

Posted: Mon Oct 11, 2004 10:40 am
by 5894817
Hi, Pep. Thank You for quick replay.

You example work fine, but unfortunately I need to use for export only standart properties of Chart Editor. I have full source code of my TeeChart version. Can You give me instructions to rebuild it (if I will find and correct this point in Chart Editor) ?

Posted: Mon Oct 11, 2004 1:49 pm
by Pep
Hi Juri,

in case you modify the sources you will have to remove the packages from the package list, open the Tee5D6 package from the list and rebuild it, you can find a install.txt file with all the instructions to recompile and install the packages under :
C:\Program Files\TeeChart Pro v502 for Delphi 6

Thank You

Posted: Tue Oct 12, 2004 7:28 am
by 5894817
Hi, Pep.
Thank You for your patiance.