BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Hopefully, a simple TOleContainer Question

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
graham
Guest





PostPosted: Wed Jan 12, 2005 9:32 pm    Post subject: Hopefully, a simple TOleContainer Question Reply with quote




Hi
I'm have an application that starts excel, creates a workbook and then passes data, sets up charts etc.

Instead of having excel running as a separate application, I would like to open it embedded within my application.

Q1 is TOleContainer the best way to do this?

Q2 How do I associate the TExcelApplication Component with the TOleContainer? (I have seen code for opening an .xls file, but nothing for creating a new workbook)

Thanks in advance

Graham.

Back to top
Thaddy de Koning
Guest





PostPosted: Thu Jan 13, 2005 10:48 pm    Post subject: Re: Hopefully, a simple TOleContainer Question Reply with quote



graham wrote:
Quote:
Hi
I'm have an application that starts excel, creates a workbook and then passes data, sets up charts etc.

Instead of having excel running as a separate application, I would like to open it embedded within my application.

Q1 is TOleContainer the best way to do this?

Q2 How do I associate the TExcelApplication Component with the TOleContainer? (I have seen code for opening an .xls file, but nothing for creating a new workbook)

Thanks in advance

Graham.

Simply put: yes, because it takes most of the pain way. here's the simplest:


Create a form with a olecontainer and a menu, filled with the mdi frame
menu template,

attach this to the 'Open' menu item:
----snip----
procedure TForm1.Open1Click(Sender: TObject);
begin
with TOpendialog.Create(self) do
try;
filter:='excel files|*.xls';
if execute then
Olecontainer1.CreateObjectFromFile(Filename, false);
finally
free;
end;
end;

---end snip----

That's all...

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.