trichview.support
Re: How to know when text item ends with cr+lf |
Author |
Message |
Sergey Tkachenko |
Posted: 03/05/2002 20:13:23 "Jose Pascoa" <japp@1dotsoft.com> wrote: > I want to be able to orderly enter every text line from 1st to last one > in a StringList. > > I have been trying the following approach however I am not able to > decide when an item ends with cr+lf. > > > procedure fillStringList; > var > theStringList : TStringList; > theString : string; > i : integer; > begin > theStringList := TStringList.create; > theString := ''; > For i := 0 to rve.ItemCount -1 do > begin > if rve.GetItemStyle(i)>=0 then > begin > if rve.GetItemText(i)='' then > theString := theString + #13#10 > else > theString := theString + rve.GetItemText(i); > end; > end; > theStringList.text := theSTring; > end; > > Please help. > > Jose > If the i-th item starts a new line (usually - starts a new paragraph), rve.IsFromNewLine(i) returns True. But the simplest way to fill TStringList is: var Stream: TMemoryStream; theStringList : TStringList; begin Stream := TMemoryStream.Create; RichViewEdit1.SaveTextToStream('', Stream, 60, False, True {or False here}); Stream.Position := 0; theStringList := TStringList.create; theStringList.LoadFromStream(Stream); Stream.Free; ... end; This method is better because you'll get also a text representation of non-text items, such as tables. |
Powered by ABC Amber Outlook Express Converter