The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> Delphi Programming
|
Copy Excel into delphi
Discuss Copy Excel into delphi in the Delphi Programming forum on Dev Shed. Copy Excel into delphi Delphi Programming forum discussing Delphi related topics including Kylix, C++ Builder, and more. Delphi is a high-performance language, originally based on the PASCAL language.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

February 10th, 2012, 12:14 AM
|
|
|
|
Copy Excel into delphi
I want to know if it is possible to copy an excel spreadsheet into delphi.
What i want to do is to copy the sheet into the WINDOWS CLIPBOARD then somehow control it in my program. Is there a way of doing it?
Many thanks in advanced!
|

February 10th, 2012, 12:39 PM
|
|
Contributing User
|
|
Join Date: Jan 2010
Posts: 68
Time spent in forums: 23 h 53 m 47 sec
Reputation Power: 4
|
|
Hi
you can read here Basic Clipboard Operations (Cut/Copy/Paste) using the TClipboard object. You don't mention how you want to present the information from the clip board in your program. If I have to guess you may want to add it in a grid. So you can load your clipboard in TStrings varaible or a TStringList and then manually add it in a ClientDataSet.
Dimiter
|

February 11th, 2012, 01:35 PM
|
|
Contributing User
|
|
Join Date: Jun 2008
Posts: 255
 
Time spent in forums: 3 Days 2 m 4 sec
Reputation Power: 5
|
|
|
You may want to look towards automating excel through OLE automation, rather than using the clipboard. Taking control of a user's clipboard is less than an optimal method.
By inserting something into the clipboard, you'd also be wiping out what may have been put there by a user, and they'd be left wondering what happened.
There's lots of good articles on automating excel from Delphi, here's one: http://edn.embarcadero.com/article/10126
|

September 4th, 2012, 04:49 AM
|
|
Registered User
|
|
Join Date: Sep 2012
Posts: 1
Time spent in forums: 8 m 28 sec
Reputation Power: 0
|
|
|
good ......
|

September 30th, 2012, 10:37 AM
|
|
Registered User
|
|
Join Date: Sep 2012
Posts: 3
Time spent in forums: 59 m 17 sec
Reputation Power: 0
|
|
|
EOleSysError in Windows 7
I'm using Delphi 4 and in trying to open Excel through my Delphi program in Windows 7, I get an exception as the program is starting... "Exception EOleSysError in module MYPROGRAM.EXE at 000979C5, Class not registered." The code works just fine in an XP environment.
|

December 18th, 2012, 03:47 AM
|
|
|
|
Re
VAR
S, T, U, V:STRING;
vTemp:string;
newpos:integer;
begin
S := Clipboard.AsText;
while s <> '' do
begin
t := copy(s, 1, pos(#9, s) - 1);
//to get the columns, parse "t"
ShowMessage(T);
vTemp := Copy(S, pos(#9, S) + 1, Length(S));
u := copy(vTemp, 1, pos(#9, vTemp) - 1);
ShowMessage(u);
vTemp := Copy(u, pos(#9, u) + 1, Length(u));
v := vtemp;
ShowMessage(v);
end;
i am trying to get each character that i have in excel..my excel file looks like this
1,2,3
4,5,6
7,8,9
Is there a beter way. I just dont get what i want. Ideally i want "1", "2", "3" first line add it to a database then go the 2nd line "4", "5", "6". *without quotes.
Any ideas?
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|