URLs are stored in items tags. By default, tags contain only URLs, so you can simply use rvEdit.GetItemTag(i).
Note 1: you should check if the item is a hyperlink. There are many types of items that can be hyperlinks:
- text (linked to textstyle having Jump=True)
- label items (and all items inherited from them, including numbering sequences, notes), linked to textstyles having Jump=True)
- tabs linked to textstyles having Jump=True
- hot pictures
- hotspots
Instead of checking all these types, it's simpler to use the undocumented method:
IsHyperlink := rvEdit.GetItem(i).GetBoolValueEx(rvbpJump, rvEdit.Style)
Note 2: If you use a simple cycle through rvEdit items, links in table cells will not be iterated. You need to use either a recursive procedure or undocumented EnumItems method. The latter is used in the "list of hyperlinks" demo:
http://www.trichview.com/forums/viewtopic.php?t=397
The example of a recursive procedure is below.
Code: Select all
uses RVItem, CRVData, RVTable;
procedure EnumLinks(RVData: TCustomRVData);
var i,r,c: Integer;
Table: TRVTableItemInfo;
begin
for i := 0 to RVData.ItemCount-1 do
if RVData.GetItem(i).GetBoolValueEx(rvbpJump, RVData.GetRVStyle) then begin
// the link target is RVData.GetItemTag(i)
end
else if RVData.GetItemStyle(i)=rvsTable then begin
Table := TRVTableItemInfo(RVData.GetItem(i));
for r := 0 to Table.RowCount-1 do
for c := 0 to Table.ColCount-1 do
if Table.Cells[r,c]<>nil then
EnumLinks(Table.Cells[r,c].GetRVData);
end;
end;