home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / Delphi / TeeChartPro / TeeChart5Delphi5Eval.exe / %MAINDIR% / Examples / Features / Export_Text.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-09-10  |  1.6 KB  |  73 lines

  1. unit Export_Text;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Base, StdCtrls, TeEngine, Series, ExtCtrls, TeeProcs, Chart;
  8.  
  9. type
  10.   TExportTextForm = class(TBaseForm)
  11.     Series1: TLineSeries;
  12.     Series2: TLineSeries;
  13.     Series3: TLineSeries;
  14.     Button1: TButton;
  15.     Button2: TButton;
  16.     SaveDialog1: TSaveDialog;
  17.     CheckBox1: TCheckBox;
  18.     procedure Button1Click(Sender: TObject);
  19.     procedure Button2Click(Sender: TObject);
  20.     procedure FormCreate(Sender: TObject);
  21.   private
  22.     { Private declarations }
  23.     Procedure ShowSavedFile;
  24.   public
  25.     { Public declarations }
  26.   end;
  27.  
  28. implementation
  29.  
  30. {$R *.DFM}
  31.  
  32. Uses TeeStore, TeExport, TeeAbout;
  33.  
  34. procedure TExportTextForm.Button1Click(Sender: TObject);
  35. begin
  36.   if SaveDialog1.Execute then
  37.   begin
  38.    { nil = all series in Chart1 }
  39.     with TSeriesDataText.Create(Chart1,nil) do
  40.     try
  41.       TextDelimiter:=',' ;  { try also: TeeTabDelimiter }
  42.       IncludeIndex:=CheckBox1.Checked;
  43.  
  44.       SaveToFile(SaveDialog1.FileName);
  45.       ShowSavedFile;
  46.     finally
  47.       Free;
  48.     end;
  49.   end;
  50. end;
  51.  
  52. procedure TExportTextForm.Button2Click(Sender: TObject);
  53. begin
  54.   TeeExport(Self,Chart1)
  55. end;
  56.  
  57. procedure TExportTextForm.FormCreate(Sender: TObject);
  58. begin
  59.   inherited;
  60.   Series1.FillSampleValues(10);
  61.   Series2.FillSampleValues(10);
  62.   Series3.FillSampleValues(10);
  63. end;
  64.  
  65. Procedure TExportTextForm.ShowSavedFile;
  66. begin
  67.   GoToURL(Handle,SaveDialog1.FileName);
  68. end;
  69.  
  70. initialization
  71.   RegisterClass(TExportTextForm);
  72. end.
  73.