Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.02.13;
Скачать: 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 вся ветка

Текущий архив: 2004.02.13;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.028 c
1-38918
snake1977
2004-02-04 13:11
2004.02.13
Теряется память!!!!


1-38941
Марат
2004-02-04 08:11
2004.02.13
MainMenu


1-38950
Piter
2004-02-04 00:42
2004.02.13
Перегрузка ShowModal


14-39013
Тимохов
2004-01-27 10:12
2004.02.13
Почуму не обновляется орешник?


14-39002
chtr
2004-01-22 07:34
2004.02.13
Иконку для D7