How to get all text?

General TRichView support forum. Please post your questions here
Post Reply
OldHawk
Posts: 16
Joined: Wed Mar 29, 2006 11:25 am

How to get all text?

Post by OldHawk »

How to dump all text to a string buf with CR+LF?
because i want to split it with CR+LF,not the item.

and,if get one string line,how to get each item of the line?
Sergey Tkachenko
Site Admin
Posts: 17310
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

For example, you can use GetAllText from RVGetText.pas:
function GetAllText(rv: TCustomRichView): String;

As for the second question, I need more details to answer.
OldHawk
Posts: 16
Joined: Wed Mar 29, 2006 11:25 am

Post by OldHawk »

thanks,i`m waiting for...
OldHawk
Posts: 16
Joined: Wed Mar 29, 2006 11:25 am

Post by OldHawk »

hi,GetAllText return string with no picture`s name? i want get it too.
Sergey Tkachenko
Site Admin
Posts: 17310
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

In order to include picture names, you need to modify GetItemText from this unit ("or (rv.GetItem(ItemNo) is TRVGraphicItemInfo)" is added):

Code: Select all

function GetItemText(rv: TCustomRichView; ItemNo: Integer): String;
begin
  if (rv.GetItemStyle(ItemNo)>=0) or (rv.GetItem(ItemNo) is TRVGraphicItemInfo) then
    Result := rv.GetItemTextA(ItemNo)
  else if rv.GetItem(ItemNo).GetBoolValue(rvbpAlwaysInText) then
    Result := rv.GetItem(ItemNo).AsText(0, rv.RVData, rv.GetItemText(ItemNo), '', True, False)
  else    
    Result := '';
end;
The same change must be done in GetItemText2.

PS: This example assumes that the picture text (which you want to insert in string) is stored in the item name (the first parameter of InsertPicture, can be read by GetItemTextA, changed by SetItemTextA).
But probably you want to insert "alternative text", stored in rvespAlt property (this property was specially added to store a text representation of image). In this case, text for images must be retrieved using GetItemExtraStrProperty method.
Sergey Tkachenko
Site Admin
Posts: 17310
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

About the second question. I wanted additional information from you :)
Generally, it's not possible to restore items from text.
Post Reply