Solved

how to create excel file by delphi

Posted on 2001-07-14
5
325 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:Mohammed Nasman
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

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

943 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

10 Experts available now in Live!

Get 1:1 Help Now