Solved

how to create excel file by delphi

Posted on 2001-07-14
5
320 Views
Last Modified: 2011-09-20
hi ihave aproblem with the servers component in delphi the procedure below should open excel97 but it doesn't do
so,i'm running excel2000.  
{ No need to start Excel ourselves, since the ExcelApplication's AutoConnect
    property is True }
  lcid := GetUserDefaultLCID;
  ExcelApplication1.Visible[lcid]:=True;

  { Create a new workbook }
  { The TOleEnum cast in the next line just prevents compiler range warnings }
  WkBk.ConnectTo(ExcelApplication1.Workbooks.Add(TOleEnum(xlWBATWorksheet), lcid));
  WS.ConnectTo(WkBk.Worksheets[1] as _Worksheet);
  WS.Name := 'Data';
  EnterData;
end;
the error message is(old format or invalid type library)
0
Comment
Question by:hussamd
5 Comments
 
LVL 22

Expert Comment

by:mnasman
ID: 6283088
Hello

Look at this page, it will help you alot to connect excel from delphi

http://www.djpate.freeserve.co.uk/AutoExcl.htm

Best regards
Mohammed
0
 
LVL 14

Expert Comment

by:DragonSlayer
ID: 6284398
You can also do it without Excel:

http://www.wotsit.org/download.asp?f=xls
0
 
LVL 21

Expert Comment

by:ziolko
ID: 6284696
Try this:
LCID:=LOCALE_USER_DEFAULT
FExcelApplication.ConnectKind:=ckNewInstance;
FExcelApplication.Connect;
FExcelWorkbook.ConnectTo(FExcelApplication.Workbooks.Add(TOleEnum(xlWBATWorksheet),LCID));
FExcelWorksheet.ConnectTo(FExcelWorkbook.Worksheets[1] as _Worksheet)
.
.
.
FExcelWorksheet.Name:='name';
.
.
FExcelApplication.Visible[LCID]:=True/False;
FExcelApplication.ScreenUpdateing[LCID]:=True/False;
FExcelApplication.displayAlerts[LCID]:=True/False;
where FExcelApplication is instance of TExcelApplication
and FExcelWorkbook is instance of TExcelWorkbook
and FExcelWorksheet is instance of TExcelWorksheet
ziolko.
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8703121
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

To be PAQ/Refund

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0
 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 8822155
PAQ'ed and points not refunded

PashaMod
CS Moderator @Experts Exchange
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 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