Insert TeeChart into Excel through OLE

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
myghetto
Newbie
Newbie
Posts: 27
Joined: Thu Oct 05, 2006 12:00 am

Insert TeeChart into Excel through OLE

Post by myghetto » Mon Jan 08, 2007 6:13 am

Hi,
I am trying to insert TeeChart into Excel through OLE. It can be inserted as a BMP or whatever as long as it is displayed in Excel. Also I need to set the dimensions so that it is size: 64 by AP in Excel measurements. Thank you.

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

Post by Pep » Mon Jan 08, 2007 4:32 pm

Hi,

the best way would be to use the TeeChart Pro ActiveX version. It can be inserted into Excel sheets as an object.
I suggest you download the (fully functional) trial version of TeeChart ActiveX version, it includes some Excel examples.

myghetto
Newbie
Newbie
Posts: 27
Joined: Thu Oct 05, 2006 12:00 am

Post by myghetto » Wed Jan 10, 2007 12:18 am

Hi,

I have just installed the evaluation version. Can't seem to find any examples for Delphi. Can you tell me the basic code of just importing a TeeChart as a picture from Delphi through OLE to Excel.

Thank you.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Jan 10, 2007 8:23 am

Hi myghetto,

The best way to open a Delphi created chart in Excel is exporting the chart to a .tee file in Delphi and load it in Excel. You'll find tutorials on how to import and export charts in both VCL and ActiveX versions program group. Also, examples of TeeChart ActiveX usage in Excel can be found at C:\Program Files\Steema Software\TeeChart Pro v7 ActiveX Control\Examples\MSOffice\VBA Excel (Default English installation path).
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

SteveP
Advanced
Posts: 132
Joined: Sun Sep 07, 2003 4:00 am

Post by SteveP » Wed Jan 10, 2007 5:58 pm

Narcis,

Can you explain how to import a .tee file into Excel ? I do not see a tutorial on how to do that.

What is the advantage of importing a .tee vs an image ? Will the .tee be resizable in Excel for example ?

Thanks,

Steve

myghetto
Newbie
Newbie
Posts: 27
Joined: Thu Oct 05, 2006 12:00 am

Post by myghetto » Thu Jan 11, 2007 12:13 am

Thanks for the reply. I don't quite understand the .Tee either but I have found the VLX example. I have been playing with the Show Export dialog which saves the chart as a JPEG. Is it possible to just control excel with Delphi and send the picture straight to an exsisting excel template?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Jan 11, 2007 9:39 am

Hello everyone,

Can you explain how to import a .tee file into Excel ? I do not see a tutorial on how to do that.

What is the advantage of importing a .tee vs an image ? Will the .tee be resizable in Excel for example ?


Steve,

A .tee file should be imported in Excel using TeeChart Pro v7 ActiveX as it is the TeeChart version supported in Excel as a live chart and able to read .tee files. TeeChart Pro v7 ActiveX in Excel is as operative as in a Visual Basic application. Excel examples and tutorials are included with TeeChart Pro v7 ActiveX (evaluation and registered versions).
Thanks for the reply. I don't quite understand the .Tee either but I have found the VLX example. I have been playing with the Show Export dialog which saves the chart as a JPEG. Is it possible to just control excel with Delphi and send the picture straight to an exsisting excel template?
myghetto,

.tee files are TeeChart natvie template files. You'll find examples in the features demo and tutorials, available at TeeChart's program group. Using them in Excel you'd have a "live" chart as you have in Visual Basic.

Regarding the image, you can export a chart in any of the supported image formats and load it anywhere you want. Using TeeChart VCL then, you'll have to generate an Excel file and load the image into it.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

myghetto
Newbie
Newbie
Posts: 27
Joined: Thu Oct 05, 2006 12:00 am

Post by myghetto » Fri Jan 12, 2007 6:49 am

Hi,

That is where I am stuck on. I can't find a way to automatically load the image into excel with a press of a button in Delphi. That is what I am trying to achieve. I am using VCL and have tried numerous ways to load it straight into Excel. What did you have in mind about the transferring with VCL cause I have been through the demos and all I found was the export dialog example. Please help. Thank you.

Best regards,

David

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Fri Jan 12, 2007 7:37 am

Hi.

Does your exported chart has to be "interactive" or is it enough to have a static image (like jpeg or metafile) ? If first, then you'll have to use ActiveX version. If later, you can easily generate chart image (using specific format), copy it to Clipboard and finally paste it into Excel worksheet. Something like this:

Code: Select all

uses TeeJPEG;
procedure TForm1.Button1Click(Sender: TObject);
begin
  with TJPEGExportFormat.Create do
  try
    Panel := Chart1;
    CopyToClipboard;
    // paste image from clipboard to Excel worksheet
    // using TExcelWorkSheet Paste method
  finally
    Free;
  end;
end;
So basically all you're doing is pasting object from Clipboard to Excel worksheet. There are loads of examples avaialable on net (how to create new worksheet, paste object from clipboard, ...).
Another way to do this might be to pass created jpeg image directly to Excel worksheet without using Clipboard. In this case I think you can use TEcelWorkSheet.Shapes.AddPicture method (I haven't tested this approach).
Marjan Slatinek,
http://www.steema.com

Post Reply