trichview.com

trichview.support




Re: Search & Replace with tables.


Return to index


Author

Message

Sergey Tkachenko

Posted: 02/11/2004 21:59:46


Hi,


var rve1, rve2: TCustomRichViewEdit;


with RichViewEdit1 do

  SetSelectionBounds(0, GetOffsBeforeItem(0), 0, GetOffsBeforeItem(0));

While RichViewEdit1.SearchText('<%DATE',[rvseoDown]) do

Begin

  rve1 := RichViewEdit1.TopLevelEditor;

  rve1.GetSelectionBounds( aStartItemNo, aStartItemOffs,

    aEndItemNo, aEndItemOffs, False);

  if RichViewEdit1.SearchText('>',[rvseoDown]) then

  begin

    rve2 := RichViewEdit1.TopLevelEditor;

    if rve2=rve1 then

    begin

      rve2.GetSelectionBounds( bStartItemNo, bStartItemOffs,

        bEndItemNo, bEndItemOffs, True);

      rve1.SetSelectionBounds( aStartItemNo, aStartItemOffs,

        bEndItemNo, bEndItemOffs);

      S:=RichViewEdit1.GetSelText;

      RichViewEdit1.InsertText(DateDecoder(S),False);

   end;

  end;

End;


Explanation: cell's items are not items of the main document. They are

indexed separately for each cell. What's why you cannot use

RichViewEdit1.SetSelectionBounds/GetSelectionBounds.

When the cell contains selection and caret, RichViewEdit creates a special

editor for this cell.

Editor containing caret is available as RichViewEdit1.TopLevelEditor.

The code above checks if '>' can be found, and if it is in the same cell.





Powered by ABC Amber Outlook Express Converter