Reputation: 9453
There are extensive properties in the TRichViewEdit
component to find most properties of a given paragraph. For instance, you can easily tell if a paragraph uses numbering, what type of numbering it uses, if it starts numbering at a specific number or is a continuation of the previous paragraph, etc.
However, I can't find a property or method to determine the paragraph number that is in use. For instance:
A. some text
B. more text
C. etc
I can't tell that some text
is paragraph number A
, that more text
is number B
, and that "etc" is 'C'. It would be okay if I could access numeric values too, like '1', '2', or '3'.
Does anyone have experience with TRichViewEdit
and know how to get the paragraph numbering value?
Upvotes: 0
Views: 563
Reputation: 9453
There is an undocumented way to do this. If rve
is the TRichViewEdit
component and ItemNo
is the id of the item number of the paragraph with numbering:
use
RVMarker;
TRVMarkerItemInfo(rve.RVData.GetItem(ItemNo)).Counter; // paragraph number as int
TRVMarkerItemInfo(rve.RVData.GetItem(ItemNo)).DisplayString; // displayed paragraph number
use
RVMarker, TypInfo;
---
var
i, lno, ll, sf: Integer;
usf: Boolean;
rvmii: TRVMarkerItemInfo;
pi: TParaInfo;
s: string;
begin
for i := 0 to rve.ItemCount - 1 do
begin
if rve.RVData.GetItemStyle(i) = rvsListMarker then
begin
pi := rve.Style.ParaStyles.Items[rve.GetItemPara(i)];
rve.GetListMarkerInfo(i, lno, ll, sf, usf);
s := GetEnumName(TypeInfo(TRVListType), Ord(rve.Style.ListStyles.Items[lno].Levels[ll].ListType));
rvmii := TRVMarkerItemInfo(rve.RVData.GetItem(i));
ShowMessage(
Concat(
'Paragraph Info', #13#10,
'---------------------------------', #13#10,
#09'OutlineLevel:', #09, IntToStr(pi.OutlineLevel), #13#10,
#09'ID:', #09#09, IntToStr(pi.ID), #13#10,
#09'Index:', #09#09, IntToStr(pi.Index), #13#10,
#13#10,
'Marker Info', #13#10,
'---------------------------------', #13#10,
#09'ListNo:', #09#09, IntToStr(lno), #13#10, // can also use 'rvmii.ListNo'
#09'ListLevel:', #09, IntToStr(ll), #13#10, // can also use 'rvmii.Level'
#09'StartFrom:', #09, IntToStr(sf), #13#10, // can also use 'rvmii.StartFrom'
#09'UseStartFrom:', #09, BoolToStr(usf), #13#10, // can also use 'rvmii.Reset'
#09'Counter:', #09, IntToStr(rvmii.Counter), #13#10,
#09'DisplayType:', #09, s, #13#10,
#09'DisplayString:', #09, rvmii.DisplayString, #13#10,
#13#10,
'ItemText', #13#10,
'---------------------------------', #13#10,
rve.GetItemText(i+1), #13#10 // next item is text for para #
)
);
end;
end;
end;
Upvotes: 3