OnLookup Event
Occurs when the component needs to lookup the value you want to use when replacing a variable in the source text.
property OnLookup: TLookupEvent;
Description
The OnLookup event will only occur while the Merge method is being called. The OnLookup event passes the name of the variable to replace in the source text along with a variable that you should assign the replacement value to. You can also predefine variables and their replacement values before calling the Merge method, if you do not want to use the OnLookup event, by using the Vars property.
Example
procedure TForm1.OnLookup(Sender:
TObject; Source: string;
var ReplaceWith: string);
begin
if Source = 'firstname' then ReplaceWith := 'John'
else if Source = 'lastname' then ReplaceWith := 'Doe';
end;
See Also