Location (location)
The Location property specifies the URL for a resource, such as an image, HTML file, or PDF.
- Browser dialog – Click the ... button and select the resource.
The URI is displayed as an absolute value, but if it is located on the same drive, it is stored internally as a relative URL.
- RTL Expression Editor – Click the fx button and enter the file
path.
The file path can be an absolute value, or it can be relative to the report design document (.4rp) that contains it. The RTL expression value can use variables to allow the file to change during processing; for example, when the image filename is stored in the database and the value can change for each row.
Type: String.
Genero Report Writer supports URLs with the protocols "http", "file", or "data" (see examples below).
This property is mandatory. An error will occur if the value is not set.
You can find the Location property in the Image, Html, or Pdf category of the Properties view.
Example 1: File
Use the "file" protocol to reference a file on disk. To specify the absolute path, use the prefix
file:///
:
file:///C:/Users/John Doe/Genero Report Writer Files/samples/OfficeStoreRes/images/office_logo.svg
The relative path is specified without a prefix:
./images/office_logo.svg
Example 2: HTTP
To include a file from an HTTP address, enter the full URL:
https://4js.com/wp-content/uploads/2015/06/genero_enterprise_800x256-300x96.png
Example 3: Data
To embed a resource, use the "data" URL type, which allows the data to be encoded in the body of the URL text. The full syntax of data URLs is:
data:[MIME-type][;charset=encoding][;base64],data
The exact form of the URL depends on whether you are embedding a resource in an Image Box, HTML Box, or PDF Box.
To automatically construct this URL, click the ... button for the Location property. Choose the file and select the Embed in document check box.
Example 4: OrderReport demo
In the OrderReport demo application, open the
OrderReport.4rp report and select the ImageBox2
element, as in
Figure 1. The Location property
uses the expression:
./images/database/"+orderline.product.prodpic.trim()