Docmosis can add hyperlinks and mailto links to documents, where the URL can be static or dynamic. With a static hyperlink the URL is known in advance. For a dynamic hyperlink, the URL is provided by the data at the time the document is generated.
A pre-defined hyperlink can appear in a document by inserting a hyperlink in to the template using the features available in the template editor. Both Microsoft Word and LibreOffice provide the ability to set the hyperlink URL and control the clickable text used for the hyperlink.
The hyperlink in the generated document will be exactly the same as that in the template and will be formatted in the hyperlink style.
A dynamic hyperlink can be created during the document generation process. Docmosis will insert a hyperlink using a URL provided in the data.
When creating a placeholder, that will result in a dynamic hyperlink, the prefix "link:" appears first, followed by the data item that will be providing the URL. For example this: <<link:companyWebsite>>, will create a hyperlink based on the companyWebsite value in the data..
In the example the data contains "URL1":"https://www.amazon.com". The template field <<link:URL1>> will result in the hyperlink : "https://www.amazon.com" appearing in the generated document.
By default, the clickable text that appears in the generated document is the same as the link supplied in the data.
Setting the clickable text for the hyperlink
Extra information can be provided in the data that will be used by Docmosis when creating the clickable text in the generated document.
The data should contain two parts, separated by the pipe "|" symbol:
- the clickable text to display
- the URL that will be used for the hyperlink
In the example, the data contains these three elements:
Hyperlink to an email address
Docmosis can insert a link which, when clicked, opens a new email addressed to a specified recipient.
In the template the <<link: syntax remains the same.
In the data, the URL should be prefixed with "mailto:" followed by the email address. The pipe "|" symbol can also still be used to control the clickable text.
In the example, the data contains these four elements: