Page 1 of 1

Questions about exporting TDBChart to Excel

Posted: Thu Jun 30, 2016 12:55 pm
by 16577771
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;

Re: Questions about exporting TDBChart to Excel

Posted: Fri Jul 01, 2016 4:14 pm
by yeray
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;

Re: Questions about exporting TDBChart to Excel

Posted: Mon Jul 04, 2016 8:51 am
by 16577771
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.

Re: Questions about exporting TDBChart to Excel

Posted: Mon Jul 04, 2016 9:26 am
by 16577771
Work's.

I need to use Teeconst.

Thank you.