text of paragraph

General TRichView support forum. Please post your questions here
Post Reply
mohsen24000
Posts: 75
Joined: Fri Jan 06, 2012 8:13 pm

text of paragraph

Post by mohsen24000 »

Hi dear sergey.
I want retrieve (get) text of paragraph that itemno is in.
for example:
in RVData my itemno is 5 and it's in 2th paragraph.
Getparatext(5) return all text of 2th paragraph.

What is the purpose of this:
user search a word and i markup it in "rv" with "MarkSubString_"
i want create a list of Phrases Found Including some text of paragraph that word is in.

for example:
user searching "Moyes" in below text:
"
Moyes will be relieved to have finally secured the signature of a high-profile transfer target, following failed pursuits of star names such as Cesc Fabregas and a reported bid for Gareth Bale during the summer window.
United's challenge has not been helped by injuries to key attackers Robin van Persie and Wayne Rooney, with the latter casting a shadow over the early days of Moyes' by allegedly agitating for a move away from the club.
"
i want create a list that consist:
"Moyes will be relieved to have finally secured the signature..."
"... shadow over the early days of Moyes' by allegedly agitating for a move away..."
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Code: Select all

uses RVTypes, RVUni;


function GetItemText(RVData: TCustomRVData; ItemNo: Integer): TRVUnicodeString;
var s: TRVRawByteString;
begin
  if RVData.GetItemStyle(ItemNo)>=0 then
    Result := RVData.GetItemTextW(ItemNo)
  else if RVData.GetItem(ItemNo).GetBoolValue(rvbpAlwaysInText) then begin
    s := RVData.GetItem(ItemNo).AsText(0, RVData, RVData.GetItemTextR(ItemNo), '', True, True, CP_ACP);
    if not RVData.GetItem(ItemNo).GetBoolValue(rvbpCanSaveUnicode) then
      s := RVU_AnsiToUnicode(RVData.GetDefaultCodePage, s);
    Result := RVU_RawUnicodeToWideString(s);
    end
  else
    Result := '';
end;

function GetParaText(RVData: TCustomRVData; ItemNo: Integer): TRVUnicodeString;
var i: Integer;
    No1, No2, Offs1, Offs2: Integer;
begin
  Result := '';
  RVData.ExpandToPara(ItemNo,ItemNo,No1,No2);
  Result := GetItemText(rve,No1);
  for i := No1+1 to No2 do begin
    if RVData.IsFromNewLine(i) then
      Result := Result + #13#10;
    Result := Result+GetItemText(rve,i);
  end;
end;
mohsen24000
Posts: 75
Joined: Fri Jan 06, 2012 8:13 pm

Post by mohsen24000 »

Thanks a lot for your guide.
it's good but i do it with another way.
please let me email it to see and assessment.
thanks again.
Sergey Tkachenko
Site Admin
Posts: 17565
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, I do not understand your last request, you can contact me using email richviewgmailcom (insert @ and dot)
Post Reply