Location (location)

The Location property specifies the URL for a resource, such as an image, HTML file, PXML file, or PDF.

To specify the URL, use one of the following:
  • 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, Pxml, or Pdf category of the Properties view.

Example 1: File

Use the "file" protocol to reference a file on disk.

Specify an absolute path with the prefix "file:///".

file:///C:/Users/John Doe/Genero Studio Files/samples/OfficeStoreRes/images/office_logo.svg

Specify a relative path with a dot (period), where the dot represents the directory containing the report design document (.4rp). No other prefix is needed.

./images/office_logo.svg

As an alternative, you can also specify a relative path omitting the dot (period) and forward slash.

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, Rich Text 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: Reports demo

In the Reports 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()
Figure: Select Image Box

Drawing shows how to select the ImageBox2 element in the OrderReport demo