Topic: How To Copy From Excel To TableGrid
How To Copy All Value From Excel To Grid in MVD By Ctrl+C ,Ctrl+V
Easy For Beginner Student For Me
My Visual Database → General → How To Copy From Excel To TableGrid
How To Copy All Value From Excel To Grid in MVD By Ctrl+C ,Ctrl+V
That's very very interesting how we can do that.
I think try use function clipboardget and splitter string but
i don't know use even at tablegrid ???
Do you want insert data to a TableGrid or to database after show it in a TableGrid?
I want to copy value from excel to tablegrid and insert to table in database ...
excel --> tablegrid --> database
help increase speed when input data
This will be one of the best functions if it works. Can we get a quicker answer please...
Example:
procedure Form1_TableGrid2_OnKeyDown (Sender: TObject; var Key: Word; Shift, Alt, Ctrl: boolean);
var
sl: TStringList;
arrFields: array of string;
i: integer;
begin
if (Ctrl) and (Key=86) then // Ctrl+V
begin
sl := TStringList.Create;
sl.Text := ClipboardGet; // get text from clipboard
// insert to database
for i := 0 to sl.Count-1 do
begin
arrFields := SplitString(sl[i], #9); // tab separator
if Length(arrFields)=2 then
begin
SQLExecute('INSERT INTO groups (groupname) VALUES('''+escape_special_characters(arrFields[1])+''')');
end;
end;
sl.Free;
end;
Form1.TableGrid2.dbUpdate;
end;
I have create an example but didn't work. I know that have a mistake somwhere but can not find it. Is it possible to send us a simply example so I can study it ?
Thank you in advance
Thank You Dmitry. Again
This Example Now use Ctrl+V only can not use right click Paste
How To Use This Effect
Step 1 Check Form Event
Step 2 Check Script (Next Example I try modify script support Field more 2)
Setp 3 - 4 Copy and Use Ctrl+V
Thank you so much, it's perfect.
but paste not working for child table grid
My Visual Database → General → How To Copy From Excel To TableGrid
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi