Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2004.02.13;
Скачать: [xml.tar.bz2];

Вниз

копирование из буфера в 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;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.44 MB
Время: 0.009 c
1-38934
-=Dev-null=-
2004-02-04 10:22
2004.02.13
Как встроить manifest в ресурсы проги ?


14-39081
Кен
2004-01-24 04:08
2004.02.13
Реклама под видом новостей


1-38911
Piter
2004-02-04 00:42
2004.02.13
Возврат результата


3-38693
onix
2004-01-21 14:48
2004.02.13
Исполнение процедуры в FB


1-38784
Clift
2004-02-03 15:30
2004.02.13
ColorDialog





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский