Delphi 2009 & Excel 2007

Posted on 2010-01-06
Medium Priority
Last Modified: 2012-05-08
How do I read/write data from/to a excel document that was created in Excel 2007?

I have looked at I have search google, but the examples is only for older version of delhi and excel.
Question by:QC20N
  • 3
  • 2
LVL 23

Expert Comment

by:Ferruccio Accalai
ID: 26198108
Reading/writing  is done in almost the same way as for previous versions, except for the Extended property part of the connection string.
So use the same example you posted in the other question and adjust it using the proper string in Extended property from this site

Author Comment

ID: 26198185
Yes, the connectionstring in the link I allready use. I was hoping that someone could show me some examples on how to use Excel_TLB. As I understand there is several ways to communicate with excel.
LVL 23

Expert Comment

by:Ferruccio Accalai
ID: 26200153
The best way to read/write Data is using ADO.
BTW to create or menage Worksheet using the type library you could follow this example, From D6 to D2009 it's almost the same.

Author Comment

ID: 26200320
Ok, but how do you control color, fontsize and font by using Excel_tlb?
LVL 23

Accepted Solution

Ferruccio Accalai earned 500 total points
ID: 26200470
Yes you can.
If I can remember, once you have your worksheet assigned using like
 WS := WBk.Worksheets.Item['Sheet1'];
then you could get or store fonts and colors of range of cells assigning values like this

with WS.Range['B1', 'C10'].font do
      Size := 20;
      FontStyle := 'Bold';
      Color := clFuchsia;
      Name := 'Arial';

Not tested, but this should work

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

807 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