Вниз
Скачать: CL | DM;

копирование из буфера в Grid   Найти похожие ветки 

← →
dendy   (2004-02-04 22:22) [0]

Господа,скопировал в буфер кусок из Excel. как вставить его в какой нибудь Grid (например в StringGrid, а лучше DBgrid) в соотвествующие столбцы.


← →
Talla2k ©   (2004-02-04 22:46) [1]

Только тут есть ошибки(незначительные).Короче юзай!!!

procedure TForm1.PasteGrid(Grid: TStringGrid; Ignore: boolean);
// При Ignore = true происходит увел.ячеек,при false урезание
var x, y, i: integer;
str, str2: string;
begin
str := Clipboard.AsText;
i := 1;
if Length(str) > 0 then
with Grid do begin
y := Row - 1;
while (str[i] <> #0) and (i < Length(str)) do begin
inc(y);
x := Col - 1;
while (str[i] <> #10) and (str[i] <> #13) and (str[i] <> #0) and (i < Length(str)) do begin
str2 := "";
while (str[i] <> #09) and (str[i] <> #10) and (str[i] <> #13) and (str[i] <> #0) {and
(i < Length(str)) }do begin
str2 := str2 + str[i];
inc(i);
end;
inc(i);
inc(x);
if (x >= ColCount) and Ignore then ColCount := ColCount + 1;
if (y >= RowCount) and Ignore then RowCount := RowCount + 1;
if not ((x >= ColCount) or (y >= RowCount)) then Cells[x, y] := str2;
end;
while ((str[i] = #10) or (str[i] = #13)) and (i < Length(str)) do
inc(i);
end;
end;
end;


← →
dendy   (2004-02-04 22:52) [2]

Вот спасибо! Все работает! счас под себя еще заточу...


← →
Talla2k ©   (2004-02-05 00:34) [3]

Как заточиш, пришли мне на мыло.Посмотрю!!



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.016 c
8-38975
Blacked
2003-10-14 01:37
2004.02.13
Как отследить окончание просмотра файла в TMediaPlayer?


1-38881
Семен Сорокин
2004-02-04 17:46
2004.02.13
Как различить одинарный и двойной клик.


7-39101
shurik_
2003-11-24 02:51
2004.02.13
реестр


3-38675
denis24
2004-01-24 10:55
2004.02.13
поиск в базе


3-38717
DelphiNew
2004-01-22 10:53
2004.02.13
Индексы




   Наверх