Solved

How can i embed excel sheet in my form, just like an activex control?

Posted on 2001-08-28
3
1,377 Views
Last Modified: 2012-08-13
Treat excel as ole automation server not favorable for my situation.

One way may be the new OWC(Office Web Component) technology, but it had a lot of limit. For example, only support one sheet.

Any idea?

Thanks.
0
Comment
Question by:HBZhang
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
Epsylon earned 200 total points
ID: 6431657
Use TOleContainer (System tab in component panel).
0
 

Author Comment

by:HBZhang
ID: 6435064
Choose OleContainer has one question, how can i access excel worksheet directly?

I want provide user a button to autofill excel sheet with some datasets.

For example:
  OleContainer1.CreateObjectFromFile('c:\test.xls',false);
  OleContainer1.DoVerb(ovSHOW);
  App := GetApplication(OleContainer1.OleObject);
  WorkBook := GetWorkBook(App);
  WorkSheet := GetWorkSheet(WorkBook);
  WorkSheet.Range(xxx) := xxx;

How can I do it if use OleContainer?

Thanks.
0
 

Author Comment

by:HBZhang
ID: 6435722
I had get it.

procedure TForm1.Button1Click(Sender: TObject);
var
  xlApp, Sheet: Variant;
begin
  xlApp := OleContainer1.OleObject.Application;
  Sheet := xlApp.WorkBooks[1].WorkSheets[1];
  Sheet.Cells[1, 1] := '1234';
  Sheet.Range['A1:C10'].Font.Bold := True;
end;

Thanks, Epsylon.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Copy file in dll not working but working on exe ! 18 88
Intraweb download file link ? 1 110
Delphi XE10 Round Image 2 79
Downloading email attachments 2 67
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now