Design
Hyperlinks
How to include hyperlinks in your report?
ENTERPRISE FEATURE
Available for:
Carbone Cloud
Carbone On-premise
Embedded Carbone JS
v3.0+
How to include Hyperlinks?
Hyperlinks can be applied dynamically to elements (text, images, tables, lists) in DOCX, ODT, ODS, and XLSX documents.
- Right-click on the element and select "Hyperlink."
- Insert the Carbone tag and confirm.
Important Notes:
- It’s not an issue if the text editor automatically replaces curly braces with special characters like
%256B
. - It’s not possible to insert a mix of a static URL and a URL from a tag, such as
https://carbone.io{d.url}
. In this case, Carbone removes thehttps://carbone.io
part and keeps only{d.url}
. - Compatibility is slightly different for XLSX files: the tag should not be enclosed in curly braces.
For example,
{d.url}
should be reduced tod.url
. Ifhttp://
appears befored.url
, it will work.
Hyperlink validation
Before injecting hyperlinks dynamically into reports, Carbone verifies if the URL has a valid format.
A valid URL should contain:
- Optional: A protocol, either
http://
orhttps://
. If a protocol is not provided, Carbone automatically addshttps://
. - Required: A root domain with a length between 2 and 256 characters.
- Required: A top-level domain (TLD) like
.com
,.org
,.fr
, or others.
If the URL does not meet these criteria, the link is replaced with: https://carbone.io/documentation.html#hyperlink-validation
:defaultURL(url)
If a dynamic hyperlink or an HTML anchor tag is injected into a report and the URL verification fails, the :defaultURL
formatter can be used to replace the default error URL.
If the provided URL isn’t valid, it will be replaced with https://carbone.io/documentation.html#hyperlink-validation
.
When inserting dynamic hyperlinks, chain the :defaultURL
formatter to the tag, like this:
{d.url:defaultURL('https://carbone.io')}
It is possible to pass another tag as an argument:
{d.url:defaultURL(.urlOnError)}
When using the :html
formatter, the :defaultURL
should be placed before:
{d.content:defaultURL(.urlOnError):html}