Bad headers in series exported to Excel format - TeeChart502

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Juri
Newbie
Newbie
Posts: 4
Joined: Fri Nov 15, 2002 12:00 am
Location: Russia
Contact:

Bad headers in series exported to Excel format - TeeChart502

Post by Juri » Mon Oct 11, 2004 8:33 am

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?

Pep
Site Admin
Site Admin
Posts: 3305
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Oct 11, 2004 9:58 am

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;

Juri
Newbie
Newbie
Posts: 4
Joined: Fri Nov 15, 2002 12:00 am
Location: Russia
Contact:

Export to Excel from Chart Editor

Post by Juri » Mon Oct 11, 2004 10:40 am

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) ?

Pep
Site Admin
Site Admin
Posts: 3305
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Oct 11, 2004 1:49 pm

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

Juri
Newbie
Newbie
Posts: 4
Joined: Fri Nov 15, 2002 12:00 am
Location: Russia
Contact:

Thank You

Post by Juri » Tue Oct 12, 2004 7:28 am

Hi, Pep.
Thank You for your patiance.

Post Reply