Поддержка / Donate
 

WebMoney

Яндекс.Деньги

SMS.Копилка
Деньги@Mail.ru
Rupay
E-gold
PayPal

 

Благодарю за поддержку!

Лента RSS - Новости сайта Новости сайта
Лента RSS - Новости форума Новости форума
Добавить в закладки и поделиться Bookmark and Share

 

Архив исходников

 


Automatic translation

 
English German French
Italian Spanish Portuguese
Greece Japan Chinese
  Korean  

  

 

  Форум  

Delphi FAQ - Часто задаваемые вопросы

| Базы данных | Графика и Игры | Интернет и Сети | Компоненты и Классы | Мультимедиа |
| ОС и Железо | Программа и Интерфейс | Рабочий стол | Синтаксис | Технологии | Файловая система |



Google  
 

Получить содержимое TStringGrid или TDrawGrid в виде строки

Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch

{ 
 This copies the contents of a TstringGrid/TDrawGrid (only Text!!) into a string. 
 Tabs are inserted between the columns, CR+LF between rows. 
}

 use
   Grids;

 {...}

 { we need this Cracker Class because the Col/RowCount property 
  is not public in TCustomGrid }
 type
   TGridHack = class(TCustomGrid);

 function GetstringGridText(_Grid: TCustomGrid): string;
 var
   Grid: TGridHack;
   Row, Col: Integer;
   s: string;
 begin
   // Cast the paramter to a TGridHack, so we can access protected properties 
  Grid   := TGridHack(_Grid);
   Result := '';
   // for all rows, then for all columns 
  for Row := 0 to Grid.RowCount - 1 do
   begin
     for Col := 0 to Grid.ColCount - 1 do
     begin
       // the first column does not need the tab 
      if Col > 0 then
         Result := Result + #9;
       Result := Result + Grid.GetEditText(Col, Row);
     end;
     Result := Result + #13#10;
 end;
 end;



Источник - Проект "Delphi World" © Выпуск 2002 - 2004
Автор проекта: Акулов Николай



   Rambler's Top100             Яндекс цитирования