Create table then RichViewEdit.Clear Problem

General TRichView support forum. Please post your questions here
Post Reply
nadirakyildiz
Posts: 12
Joined: Thu May 21, 2009 8:38 am

Create table then RichViewEdit.Clear Problem

Post by nadirakyildiz »

These codes add the table and looks fine but If I clear the RichViewEdit then get error from procedure TCustomRVData.Clear

SRE.RichViewEdit.InsertItem('', Table); This line run 2 times. If run 1 times ther isnt't any problem

I can't clear or I can't Free the form couse this problem.
Sorry For my Bad English :)

Code: Select all

var
  Table: TRVTableItemInfo;
  i: Integer;
begin

  if SL.Count > 0 then
  begin
    Table := TRVTableItemInfo.CreateEx(SL.Count, 2, SRE.RichViewEdit.RVData);
    Table.BestWidth := -100; 
    Table.CellHPadding := 3;

    for i := 0 to SL.Count - 1 do
    begin
      Table.Cells[i, 0].Clear;
      Table.Cells[i, 1].Clear;

      Table.Cells[i, 0].AddNL(SL.Strings[i], 0, 0);
      Table.Cells[i, 1].AddNL(SL2.Strings[i], 0, 0);

    end;
    Table.BorderWidth := 0;
    Table.CellBorderWidth := 0;
	
    SRE.RichViewEdit.SelectAll;
    while SRE.RichViewEdit.SearchText('[#TABLE#]', [rvseoWholeWord]) do
    begin
      SRE.RichViewEdit.InsertItem('', Table);
    end;
    SRE.RichViewEdit.Format;
	(*
	//SRE.RichViewEdit.Clear  
	// if I Clear then get error from 
	<
	procedure TCustomRVData.Clear
		- for i:=0 to Items.Count-1 do
        FreeItem(i,True);  --------error Line
		> 
	*)
  end;
Sergey Tkachenko
Site Admin
Posts: 17554
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You cannot insert the same item (table) several times.
Create a new table each time you want to insert it.
Post Reply