Have a look at   http://cc.embarcadero.com/Item/17032
This knowledge base article provides reasonably full featured sample code ...

Brian
--------------------------------------------------
From: "SoftTech" <[email protected]>
Sent: Tuesday, February 15, 2011 11:44 PM
To: "Delphi-Talk Discussion List" <[email protected]>
Subject: Re: Listview (pull all data from)

I have determined how I should be pulling the data for the columns, but they are all empty strings. Any ideas why?

Here is the code:

procedure TForm1.Button1Click(Sender: TObject);
var
 LineNo: Integer;
 PrintText: TextFile;

 LineItem: TListItem;

 I: Integer;
 sName: String;
 sSize: String;
 sType: String;
 sDateModified: String;

 S: String;
begin
 if PrintDialog1.Execute then
   begin
     AssignPrn(PrintText);
     Rewrite(PrintText);

     Printer.Canvas.Font := RzShellList1.Font;

     for LineNo := 0 to RzShellList1.Items.Count -1 do
       begin
         LineItem := RzShellList1.Items[LineNo];

         sName := LineItem.Caption;

         For I := 0 to LineItem.SubItems.Count-1 do
           begin
             case I of
               0: sSize := LineItem.SubItems[I];
               1: sType := LineItem.SubItems[I];
               2: sDateModified := LineItem.Subitems[I];
             end;

             S:= LineItem.Caption;
             S:= S + #9 + LineItem.Subitems[I];
           end;

         Writeln(PrintText, RzShellList1.Items[LineNo].Caption);
       end;

     CloseFile(PrintText);
   end;
end;



----- Original Message ----- From: "SoftTech" <[email protected]>
To: "Delphi - Talk" <[email protected]>
Sent: Tuesday, February 15, 2011 5:41 AM
Subject: Listview (pull all data from)


Greeting All,

Guess I'm brain dead today.

Can anyone share how to pull data from a TListView where ViewStyle = vsReport for all columns and for all data even that data not shown in the treeview?

This code pulls the first column only and only the data shown in the treeview. If I page down in the treelist there is more data.

procedure TForm1.Button1Click(Sender: TObject);
var
 Line: Integer;
 PrintText: TextFile;
begin
 if PrintDialog1.Execute then
   begin
     AssignPrn(PrintText);
     Rewrite(PrintText);

     Printer.Canvas.Font := RzShellList1.Font;

     for Line := 0 to RzShellList1.Items.Count -1 do
Writeln(PrintText, RzShellList1.Items[Line].Caption + ' ' + RzShellList1.Items[Line].SubItems [1]);

     CloseFile(PrintText);
   end;
end;

I need to pull data form all columns, and for all data not currently shown in the treelist as well...

The treelist contains the same data that one see in windows explorer when looking at folders and files.

Thanks,

Mike
__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk

--
MailScanner Virus/Spam/Malware: PASS (GZ)



__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1204 / Virus Database: 1435/3452 - Release Date: 02/18/11

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk

Reply via email to