Hello,
first, I apologize for my poor english.
I try to get a line text in TRichviewEdit, there's a small problem.
a line is, Example...
This is a test line...
S := rve.GetItemText(0) -> result S) This is a test line...
And I Change TextStyle to BOLD(or Underline, etc...) at a word in a line, Example...
This is a test line...
S := rve.GetItemText(0) -> result S) This
and 'is a test line...' is Changed ItemNo = 1.
How get I full line text?
GetItemText?
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: GetItemText?
Items are not lines. One text item can occupy multiple lines. One line can contain multiple items.
Probably, you mean not lines but paragraphs, i.e. text between "Enters".
There are also paragraph sections, i.e. text between "Enters" or "Shift+Enters".
In this case, to get text of a paragraph (or a paragraph section), you need to get text from all items in it.
If you want text for the current paragraph or paragraph section, you can use the functions from RVGetTextW unit (or, if you need ANSI versions of these functions, RVGetText unit):
If you need a function returning text for a paragraph (or a paragraph section) containing the item having the specified index, let me know, I'll write it here.
Probably, you mean not lines but paragraphs, i.e. text between "Enters".
There are also paragraph sections, i.e. text between "Enters" or "Shift+Enters".
In this case, to get text of a paragraph (or a paragraph section), you need to get text from all items in it.
If you want text for the current paragraph or paragraph section, you can use the functions from RVGetTextW unit (or, if you need ANSI versions of these functions, RVGetText unit):
Code: Select all
function GetCurrentParaSectionText(rve: TCustomRichViewEdit): TRVAnsiString;
function GetCurrentParaText(rve: TCustomRichViewEdit): TRVAnsiString;
-
- Posts: 7
- Joined: Wed Nov 01, 2017 11:13 am
Re: GetItemText?
Thanks to your kindly answer.
I try to use GetCurrentPara(Section)Text in RxGetText unit, but there's no ParaText function for using specified ItemNo.
I need to get Para(Section)Text for using specified ItemNo.
function example...
function GetPara(Section)Text(rve: TCustomRichViewEdit; ItemNo: Integer): string;
using example...
S := GetPara(Section)Text(rve, 15);
I try to use GetCurrentPara(Section)Text in RxGetText unit, but there's no ParaText function for using specified ItemNo.
I need to get Para(Section)Text for using specified ItemNo.
function example...
function GetPara(Section)Text(rve: TCustomRichViewEdit; ItemNo: Integer): string;
using example...
S := GetPara(Section)Text(rve, 15);
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: GetItemText?
Code: Select all
function GetItemText(rve: TCustomRichView; ItemNo: Integer): String;
begin
if rve.GetItemStyle(ItemNo) >= 0 then
Result := rve.GetItemText(ItemNo)
else if rve.GetItemStyle(ItemNo) = rvsTab then
Result := #9
else
Result := '';
end;
function GetParaText(rve: TCustomRichView; ItemNo: Integer): String;
var
i, No1, No2: Integer;
begin
Result := '';
rve.RVData.ExpandToPara(ItemNo, ItemNo, No1, No2);
for i := No1 to No2 do
begin
if (i > No1) and rve.IsFromNewLine(i) then
Result := Result + #13#10;
Result := Result + GetItemText(rve, i);
end;
end;
function GetParaSectionText(rve: TCustomRichView; ItemNo: Integer): String;
var
i, No1, No2: Integer;
begin
Result := '';
rve.RVData.ExpandToParaSection(ItemNo, ItemNo, No1, No2);
for i := No1 to No2 do
Result := Result + GetItemText(rve, i);
end;