trichview.support
Re: Replace text with new component TppRichView |
Author |
Message |
Sergey Tkachenko |
Posted: 04/17/2004 19:42:51 ppRichView.RichView is of TRichView type. Here is a code for replacing in TRichView procedure ReplaceAll(RVData: TCustomRVData; const OldText, NewText: string); var i, r, c: Integer; table: TRVTableItemInfo; s: String; begin for i := 0 to RVData.Items.Count - 1 do if RVData.GetItemStyle(i) >= 0 then begin s := RVData.GetItemTextA(i); s:= StringReplace(s, OldText, NewText, [rfReplaceAll]); RVData.SetItemTextA(i, s); end else if RVData.GetItemStyle(i) = rvsTable then begin table := TRVTableItemInfo(RVData.GetItem(i)); for r := 0 to table.Rows.Count - 1 do for c := 0 to table.Rows[r].Count - 1 do if table.Cells[r, c] <> nil then ReplaceAll(table.Cells[r, c].GetRVData, OldText, NewText); end; end; call: ReplaceAll(pprv.RichView.RVData, OldText, NewText); > > As I can select a word inside of the component tppRichView and change for > another one. In the component tRichView I used SelectCurrentWord and InsertText |
Powered by ABC Amber Outlook Express Converter