Using Report Anchors
Anchors allow you to create clickable navigation inside a Articles report. They work like links on a web page: clicking a control jumps to another location within the prepared report.
Typical uses include:
- Table of contents
- Jumping to sections in long reports
- โBack to topโ links
- Navigation between summary and detail sections
Creating an anchor
Every anchor must have a unique name. Anchors are created in the report script using the report engine.
Syntax:
Engine.AddAnchor('AnchorName');
You usually add anchors in a control event, such as OnBeforePrint.
Example:
procedure Memo4OnBeforePrint(Sender: TfrxComponent);
begin
Engine.AddAnchor('InventorySection');
end;
When this memo prints, Articles records its position and assigns it the anchor name InventorySection.
Creating a link to an anchor
To make a control clickable, use its Hyperlink property. In this example, we use a TfrxMemoView.
- Select the memo (or any view object).
- In the Object Inspector, expand Hyperlink.
- Set:
- Kind =
hkAnchor - Value =
InventorySection(or the anchor name you used in script)
- Kind =
When the report is previewed:
- The mouse cursor changes to a hand pointer over the memo.
- Clicking the memo jumps directly to the object where the anchor was created.
Example workflow
1. Add an anchor at a section header (in script):
Engine.AddAnchor('TopOfReport');
2. Add a clickable link to that anchor (in the memoโs Hyperlink):
- Kind =
hkAnchor - Value =
TopOfReport
Result:
Clicking the memo scrolls the preview to the anchor location.
Notes and best practices
- Anchor names must be unique within the report.
- Anchor navigation works in:
- Report preview
- PDF export
- HTML export
- Anchors do not affect layout, band size, or print order.
- Avoid spaces in anchor names; use simple identifiers like:
Section1CustomerListTopOfPage