trichview.support
Re: StringReplace()? |
Author |
Message |
Sergey Tkachenko |
Posted: 08/14/2002 20:39:04 There are two methods: 1) using SearchText+InsertText. + simple - slow: requires formatted document - slow and flickering, because document is updated on each replace 2) You can enumerate all items in document, and perform search in each text item yourself. You can use the following function as a base: procedure AllUpperCase(RVData: TCustomFormattedRVData); var i,r,c: Integer; table: TRVTableItemInfo; begin for i := 0 to RVData.Items.Count-1 do if RVData.GetItemStyle(i)>=0 then begin // this is a text item s := RVData.Items[i]; s := AnsiUpperCase(s); // WARNING: will not work with Unicode RVData.Items[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 AllUpperCase(table.Cells[r,c].GetRVData); table.Changed; end; end; AllUpperCase(rv.RVData); > hi Sergey :) > > I am sorry for asking so much and thank you already again for such a > great support :) > Well, I have some "variables" in my richview-documents that looks like > [<Title>] and so on. Now I want to replace all foundings with a String, > e.g. "test". With a TMemo I would do Memo.Text := > StringReplace(Memo.text, '[<Title>]', 'test', [rfReplaceAll]), but how > would I do in TRichview? > > Btw.: To give the community that helps something back, I have published > two OpenSource Components made by me, just look at www.alex-adam.de :) > > thanks again, > Alex > |
Powered by ABC Amber Outlook Express Converter