trichview.com

trichview.support




Re: export table as txt-file - mistake found


Return to index


Author

Message

jb

Posted: 03/13/2005 12:16:08


I hope I have found the mistake:


> for i := 0 to RVData.ItemCount-1 do begin

>   if RVData.GetItemStyle(i)>=0 then write(ziel, rveTable.Cells[r,c].getItemTextA(i))


xxx.getItemTextA(i)           is wrong. 

xxx.GetRVData.GetItemText(i)) seems to be correct (or  ??? xxx.GetRVData.GetItemTextA(i)

???)


Once more, thanks to Sergey



Here the correct code


"jb" <j.braelye@t-online.de> wrote:

>

>Hello Sergey,

>

>many thanks for your help. Your code (table to txt-file) doesn't work correct.

>It produces the error ('Listenindex überschreitet das Maximum (0)').

>

>Your mailbox returns my eMail (to you) back to sender (since a week).

>

>What is wrong ?

>

>procedure TForm1.Tab2TxtSpeiClick(Sender: TObject);

>var item: TCustomRVItemInfo;

>                rveTable: TRVTableItemInfo;              

>                rve: TCustomRichViewEdit;

>                RVData: TCustomRVData;

>                ziel: textFile;

>                r,c,i: integer;

>begin

>  if not memo.GetCurrentItemEx(TRVTableItemInfo, rve, item) then begin

>    showMessage('Die Tabelle hat nicht den Focus !');

>    exit;

>  end;

>

>

>  rveTable := TRVTableItemInfo(item);

>  try

>    assignfile(ziel, '123.txt');

>    rewrite(ziel);

>    for r := 0 to rveTable.Rows.Count-1 do begin

>     

>      for c := 0 to rveTable.Rows[r].Count-1 do begin

>        if rveTable.Cells[r,c]<>nil then begin

>          RVData := rveTable.Cells[r,c].GetRVData;

>          for i := 0 to RVData.ItemCount-1 do begin

>            if RVData.GetItemStyle(i)>=0 then write(ziel, rveTable.Cells[r,c].GetRVData.GetItemText(i))

>            else if RVData.GetItemStyle(i)=rvsTab then write(ziel, #9);

>          end;

>          if c+rveTable.Cells[r,c].ColSpan<>rveTable.Rows[r].Count then

write(ziel,

>';');

>        end; // if rveTable.

>      end;   // c := 0 to

>    

>      if r<>rveTable.Rows.Count-1 then writeln(ziel);

>    end;     // r := 0 to

>  finally

>    closeFile(ziel);

>  end;

>

>end;





Powered by ABC Amber Outlook Express Converter