Solved

how to create excel file by delphi

Posted on 2001-07-14
5
329 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

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

Suggested Solutions

Title # Comments Views Activity
Correct Component for Shopping Cart. 2 121
Making delphi communicate with a c# service 16 122
Working with hours 3 72
IP without any Dots 1 51
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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…

740 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