Is it possible to copy and paste cells to and from Excel and TNxGrid? I just need to copy/paste the values, not formulas.
Thanks,
Mike
Posted 12 August 2015 - 12:47 AM
Is it possible to copy and paste cells to and from Excel and TNxGrid? I just need to copy/paste the values, not formulas.
Thanks,
Mike
Posted 12 August 2015 - 05:19 AM
I figure I should be a bit more specific.
1. Select a block of cells in Excel
2. CTRL-C to copy to the clipboard
3. Select the top-left cell in my TNxGrid
4. CTRL-V to copy the block of cells in teh clipboard to teh grid.
Thanks, Mike
Posted 12 August 2015 - 05:00 PM
Posted 12 August 2015 - 05:09 PM
Thanks.
I'm familiar with the clipboard, but not with the structure/format of the Excel data. I guess it's time I learned.
By the way, all I need to copy/paste are the values, not the styles.
Posted 12 August 2015 - 05:39 PM
Hi,
I think that Excel will simply copy value to Clipboard as any other application. I suggest that you copy/paste into empty text file and see what is output.
Posted 12 August 2015 - 06:36 PM
Thanks.
It looks like it is tab delminted values (not formulas). I should be able to work with that by loading it into a TStringList or something and parsing it there.
Any tips on how to handle the CTRL-V part? I suppose I could always use a pop-up menu.
Posted 12 August 2015 - 06:51 PM
Hello m610,
here is a small procedure from NextGrid to Clipboard. I found this everywhere in net. I hope it help you.
LD
uses clipbrd;
procedure NextGrid_ToClipboard(AGrid: TNextGrid; withHeader:Boolean);
var s : String;
c,r : Integer;
begin
s := '';
if withHeader
then
begin
for r := 0 to AGrid.Columns.Count-1 do
s := s + Trim(AGrid.Columns[r].Header.Caption) + #9;
s := s + #13;
end;
for r := 0 to AGrid.RowCount - 1 do
begin
for c := 0 to AGrid.Columns.Count - 1 do
begin
s := s + Trim(AGrid.Cell[c,r].AsString) + #9;
s := s + #13;
end;
end;
Clipboard.AsText := s;
end;
Posted 12 August 2015 - 07:42 PM
NextSuite v5 - VCL Components (Previous version) →
NextGrid Component →
enter a cell in edit mode, like excel's F2 command?Started by d6user, 21 Sep 2013 excel, edit mode |
|
0 members, 0 guests, 0 anonymous users