Solved

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

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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