Questions about exporting TDBChart to Excel

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
user_bme
Newbie
Newbie
Posts: 4
Joined: Tue Mar 01, 2016 12:00 am

Questions about exporting TDBChart to Excel

Post by user_bme » Thu Jun 30, 2016 12:55 pm

When I export data of my application from TDbChart componenet to Excel, export appears like:

I need:
Replace the text in the first column "Text" for "Value"
Hide / Remove the "X" column

How can I do it?

PD:

Version TeeChar Pro v2015.26.150901 32 bit VCL

Attached example of my code

Code: Select all

procedure TFGestionCurvasCalculadas.actExportExecute(Sender: TObject);
var tmpChart: TChart;
    i       : Integer;
begin
  tmpChart := TChart.Create(Self);

  try
    for i := 0 to dbcCurves.SeriesCount - 1 do
    begin
      if dbcCurves[i].Active then
      begin
        CloneChartSeries(dbcCurves.Series[i]).ParentChart := tmpChart;
        tmpChart.SeriesList[i].XValues.DateTime := True;
        tmpChart.SeriesList[i].YValues.Name := 'Curve';
      end;
    end;

    with TSeriesDataXLS.Create(tmpChart, nil) do
    try
      UseSeriesFormat := True;
      IncludeHeader := True;

      SaveToFile('C:\TEMP\example.xls');
    finally
      Free;
    end;

  finally
    tmpChart.Free;
  end;
end;

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Questions about exporting TDBChart to Excel

Post by Yeray » Fri Jul 01, 2016 4:14 pm

Hello,

You could do something like this:

Code: Select all

uses TeeStore, TeeConst;

type TSeriesAccess=class(TChartSeries);

procedure TForm1.Button1Click(Sender: TObject);
begin
  TeeMsg_Text:='Value';
  TSeriesAccess(Series1).IUseNotMandatory:=false;

  with TSeriesDataXLS.Create(Chart1, nil) do
    try
      UseSeriesFormat := True;
      IncludeHeader := True;

      SaveToFile('E:\tmp\example.xls');
    finally
      Free;
    end;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

user_bme
Newbie
Newbie
Posts: 4
Joined: Tue Mar 01, 2016 12:00 am

Re: Questions about exporting TDBChart to Excel

Post by user_bme » Mon Jul 04, 2016 8:51 am

First of all, thanks for your help.

I've already got the "x" column does not appear.

The problem is the caption "Text", I need to change it to "Value".
In the example that you sent me, the variable "TeeMsg_Text" appears, but do you not use it anywhere. I think you let use to show me how to change the text.

I wait your answer.

Thank you very much.

user_bme
Newbie
Newbie
Posts: 4
Joined: Tue Mar 01, 2016 12:00 am

Re: Questions about exporting TDBChart to Excel

Post by user_bme » Mon Jul 04, 2016 9:26 am

Work's.

I need to use Teeconst.

Thank you.

Post Reply