Link to home
Start Free TrialLog in
Avatar of denssan
denssanFlag for Switzerland

asked on

Copy from Excel into a Delphi stringgrid

How can I paste one or several columns of an excel sheet into a Stringgrid of Delphi ?
SOLUTION
Avatar of APS NZ
APS NZ
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of denssan

ASKER

How do you install or import excel_tbl ?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of denssan

ASKER

The situation is as follows :
I have an excel sheet open. I select the area, I want to copy.
I copy the area with Cntr C, Cntr V into a Delphi 7 stringgrid.

This is, what I want to do.

As the size of the selected area varies, the stringgrid has to adapt itself automatically the size pasted area
Avatar of denssan

ASKER

Hi jdthedj,

Meanwhile I figured out, how to get Excel_tbl. A question : Where does this lonely end statement within the repeat until loop belong to ?

Kean to here from you

denssan
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of denssan

ASKER

The solution of developmentguru was easy to understand, very elegant and straightforward. Congratulations !!
To your remark : We have all the same version of Excel throughout the whole company and I have to process hundreds of values not thousand of values, so copy/paste from Excel works quite nicely. As alternative I have implemented the procedure of jdthedj. His solution was also easy to understand, once you figured out the meaning of the variables.  Unfortunately he didn't answer my question for what reasons ever, so I lost some time trying to answer it myself. His solution works too. What is still unclear, is where the variable dataLine gets its value. I just commented that line out.
A suggestion to all : Don't just send a snippet of code without any explanation hoping the reader would be smart enough to guess the meaning of the variables and how the program works. Some expanation clarifying at least the meaning of the variables especially if their values are assigned outside the code snippet are helpful to reader and save a lot of time.
Many thanks to developmentguru and jdthedj.
denssan