@@ -7,6 +7,9 @@ interface |
| 7 |
uses |
7 |
uses |
| 8 |
Classes, SysUtils, Constants, Clipbrd, HugeDatatypes, Utils; |
8 |
Classes, SysUtils, Constants, Clipbrd, HugeDatatypes, Utils; |
| 9 |
|
9 |
|
|
|
10 |
type |
|
|
11 |
EClipboardFormatException = class(Exception); |
|
|
12 |
|
| 10 |
function GetPastedCells: TSelection; |
13 |
function GetPastedCells: TSelection; |
| 11 |
procedure CopyCells(Selection: TSelection); |
14 |
procedure CopyCells(Selection: TSelection); |
| 12 |
|
15 |
|
@@ -59,21 +62,26 @@ var |
| 59 |
begin |
62 |
begin |
| 60 |
SL := TStringList.Create; |
63 |
SL := TStringList.Create; |
| 61 |
try |
64 |
try |
| 62 |
SL.Text := Clipboard.AsText; |
65 |
try |
| 63 |
|
66 |
SL.Text := Clipboard.AsText; |
| 64 |
// Delete lines until we reach the note data |
67 |
|
| 65 |
while not SL.Strings[0].StartsWith('|') do |
68 |
// Delete lines until we reach the note data |
| 66 |
SL.Delete(0); |
69 |
while not SL.Strings[0].StartsWith('|') do |
| 67 |
SetLength(Result, SL.Count); |
70 |
SL.Delete(0); |
| 68 |
|
71 |
SetLength(Result, SL.Count); |
| 69 |
I := 0; |
72 |
|
| 70 |
for Row in SL do begin |
73 |
I := 0; |
| 71 |
StringCells := Row.Split('|'); |
74 |
for Row in SL do begin |
| 72 |
|
75 |
StringCells := Row.Split('|'); |
| 73 |
SetLength(Result[I], Length(StringCells)-1); |
76 |
|
| 74 |
for J := 0 to High(StringCells)-1 do |
77 |
SetLength(Result[I], Length(StringCells)-1); |
| 75 |
Result[I, J] := ParseCell(StringCells[J+1]); |
78 |
for J := 0 to High(StringCells)-1 do |
| 76 |
Inc(I); |
79 |
Result[I, J] := ParseCell(StringCells[J+1]); |
|
|
80 |
Inc(I); |
|
|
81 |
end; |
|
|
82 |
except |
|
|
83 |
on E: Exception do |
|
|
84 |
raise EClipboardFormatException.Create('Clipboard contained invalid data!'); |
| 77 |
end; |
85 |
end; |
| 78 |
finally |
86 |
finally |
| 79 |
SL.Free; |
87 |
SL.Free; |