Komplett speichern (mit Spaltennamen,...)
Delphi-Quellcode:
Procedure LV2Ini(LV: TListView; Const IniPath: String);
Var
SetFile: TIniFile;
Col, Row: Integer;
TempStr: String;
// Hier kannst du nehmen was du willst ;)
Const
Delimitter = ';';
Begin
SetFile := TIniFile.Create(IniPath);
Try
With LV Do
With SetFile Do
Begin
If Columns.Count > 0 Then
Begin
For Col := 0 To pred(Columns.Count) Do
TempStr := TempStr + Delimitter + Column[Col].Caption;
Delete(TempStr, 1, Length(Delimitter));
WriteString('ListView', 'Columns', TempStr);
TempStr := '';
For Row := 0 To pred(Items.Count) Do
With Items[Row] Do
Begin
TempStr := Caption;
For Col := 0 To pred(SubItems.Count) Do
TempStr := TempStr + Delimitter + SubItems[Col];
WriteString('ListView', 'Row_' + IntToStr(succ(Row)), TempStr);
End;
End;
UpdateFile;
End;
Finally
FreeAndNil(SetFile);
End;
End;