Page 1 of 1
Insert TeeChart into Excel through OLE
Posted: Mon Jan 08, 2007 6:13 am
by 9347662
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.
Posted: Mon Jan 08, 2007 4:32 pm
by Pep
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.
Posted: Wed Jan 10, 2007 12:18 am
by 9347662
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.
Posted: Wed Jan 10, 2007 8:23 am
by narcis
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).
Posted: Wed Jan 10, 2007 5:58 pm
by 9333098
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
Posted: Thu Jan 11, 2007 12:13 am
by 9347662
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?
Posted: Thu Jan 11, 2007 9:39 am
by narcis
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.
Posted: Fri Jan 12, 2007 6:49 am
by 9347662
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
Posted: Fri Jan 12, 2007 7:37 am
by Marjan
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).