Другие языки программирования и технологии
Как загрузить базу данных *.xls в компонент TListView (Delphi)?
Необходимо загрузить в компонент TListView данные из файла *.xls или из текстового файла *.txt.Какой алгоритм выполняет это действие?
если известна структура, то в чем проблема?
если структура неизвестна тогда ой!! !
интересно что получит Вася не зная структуры файла?
если структура неизвестна тогда ой!! !
интересно что получит Вася не зная структуры файла?
{
This example requires a TListView, a TImageList and a
TComboBox. You will need to double click the image list and
add several images to the image list prior to running the
project. You can use *.bmp or *.ico files from the
\Images\Icons directory. During the form’s OnCreate event
handler, items for the List View control are created for
each image in the Image List and the ImageIndex is assigned
the number of the image within the ImageList. Two columns are
created so that when ViewStyle is vsReport, you will have
columns to view. Also within the form’s OnCreate event
handler assign the ComboBox each of the four TViewStyle
constants to the Items’ Objects property. You could also
simply code this within a series of OnClick event handlers
as, for instance, ListView1.->ViewStyle := vsIcon.
}
procedure TComboForm.FormCreate(Sender: TObject);
var
I: Integer;
ListItem: TListItem;
NewColumn: TListColumn;
begin
Col2Array[0]:= 'Documentation for Image0.';
Col2Array[1]:= 'Documentation for Image1.';
Col2Array[2]:= 'Documentation for Image2.';
// Create a ListView item for each image in the ImageList
with ListView1 do
begin
SmallImages := ImageList1;
LargeImages := ImageList1;
for I := 0 to ImageList1.Count - 1 do
begin
ListItem := Items.Add;
Listitem.Caption := 'Image' + IntToStr(I);
ListItem.ImageIndex := I;
Listitem.SubItems.Add(Col2Array);
end;
// Create two columns to show during viewing as vsReport
NewColumn := Columns.Add;
NewColumn.Caption := 'Column 1';
NewColumn.Width := 200;
NewColumn := Columns.Add;
NewColumn.Caption := 'Column 2';
NewColumn.Width := 200;
// Add View styles and constants to the Combo Box
ComboBox1.Items.AddObject('vsIcon', TObject(vsIcon));
ComboBox1.Items.AddObject('vsList', TObject(vsList));
ComboBox1.Items.AddObject('vsReport', TObject(vsReport));
ComboBox1.Items.AddObject(
'vsSmallIcon', TObject(vsSmallIcon));
// Display first item in the Combo Box
ComboBox1.ItemIndex := 0;
end;
end;
procedure TComboForm.ComboBox1Click(Sender: TObject);
begin
with ComboBox1 do
ListView1.ViewStyle := TViewStyle(Items.Objects[ItemIndex]);
end;
This example requires a TListView, a TImageList and a
TComboBox. You will need to double click the image list and
add several images to the image list prior to running the
project. You can use *.bmp or *.ico files from the
\Images\Icons directory. During the form’s OnCreate event
handler, items for the List View control are created for
each image in the Image List and the ImageIndex is assigned
the number of the image within the ImageList. Two columns are
created so that when ViewStyle is vsReport, you will have
columns to view. Also within the form’s OnCreate event
handler assign the ComboBox each of the four TViewStyle
constants to the Items’ Objects property. You could also
simply code this within a series of OnClick event handlers
as, for instance, ListView1.->ViewStyle := vsIcon.
}
procedure TComboForm.FormCreate(Sender: TObject);
var
I: Integer;
ListItem: TListItem;
NewColumn: TListColumn;
begin
Col2Array[0]:= 'Documentation for Image0.';
Col2Array[1]:= 'Documentation for Image1.';
Col2Array[2]:= 'Documentation for Image2.';
// Create a ListView item for each image in the ImageList
with ListView1 do
begin
SmallImages := ImageList1;
LargeImages := ImageList1;
for I := 0 to ImageList1.Count - 1 do
begin
ListItem := Items.Add;
Listitem.Caption := 'Image' + IntToStr(I);
ListItem.ImageIndex := I;
Listitem.SubItems.Add(Col2Array);
end;
// Create two columns to show during viewing as vsReport
NewColumn := Columns.Add;
NewColumn.Caption := 'Column 1';
NewColumn.Width := 200;
NewColumn := Columns.Add;
NewColumn.Caption := 'Column 2';
NewColumn.Width := 200;
// Add View styles and constants to the Combo Box
ComboBox1.Items.AddObject('vsIcon', TObject(vsIcon));
ComboBox1.Items.AddObject('vsList', TObject(vsList));
ComboBox1.Items.AddObject('vsReport', TObject(vsReport));
ComboBox1.Items.AddObject(
'vsSmallIcon', TObject(vsSmallIcon));
// Display first item in the Combo Box
ComboBox1.ItemIndex := 0;
end;
end;
procedure TComboForm.ComboBox1Click(Sender: TObject);
begin
with ComboBox1 do
ListView1.ViewStyle := TViewStyle(Items.Objects[ItemIndex]);
end;
ListView.Items.LoadFromFile(ИмяФайла)
Похожие вопросы
- Delphi! База данных, помогите с логикой, работа с TDateTime? (clientdataset)
- Сайт на PHP и база данных.
- ЛЮДИ зачем нужны БД (базы данных для сайта) ? Объясните девушки пожалуйста.
- Очень интересный вопрос "Не удается открыть системную базу данных ядра Microsoft JET"
- Помогите создать базу данных на паскале.
- Подскажите - зачем нужны вообще базы данных.
- Вопрос про базу данных на примере страховой компании
- Как правильно спроектировать базу данных для книжного магазина?
- Создание базы данных на Turbo C
- база данных как создать базу данных с помощью чего и как?