Solved

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

Posted on 2001-08-28
3
1,380 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 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