Uploading Suggested File Resources

A JRXML file doesn’t embed resources, such as images. When the server uploads the JRXML, it tries to detect and list missing resources, as shown in the figure “Suggested Resources in the Resources List”. You need to take one of the following actions:

Upload resources that the report needs.
Select a resource from the repository to the report.

If the Controls & Resources page doesn’t list any suggested file resources, perhaps the report doesn’t reference any. Often, the server can’t detect all of the referenced resources, as discussed in Uploading Undetected File Resources.

To upload suggested file resources for the simple report example:

1. Click Add Now in the same row as the suggested resource. For example, click Add Now for LogoLink.

The Locate File Resource page appears.

2. Choose Select a resource from the Repository, and Browse to an image file. For example, Browse to Images/JR Logo.

Any image file works.

3. Click Select.

The path to the image appears in the wizard.

4. Click Next.

The Add a Report Resource page appears:

Properties of a Resource

The properties include the LogoLink name, resource ID, and description. These properties don’t redefine the properties of the JRLogo file in the repository.

5. Click Next to accept the default naming of the file resource.

The Controls & Resources page appears again, showing that the LogoLink resource was added.

6. On Controls and Resources, click Add Now in the AllAccounts_Res2 row.

The Locate File Resource page appears again.

7. Select Upload a Local File, and Browse to <js-install>/samples/images/logo.jpg.
8. Open logo.jpg, and click Next.

The server uploads the file.

The Add a Report Resource page appears, showing the properties of the file resource.

The properties include the AllAccounts_Res2 name, resource ID, and description.

9. Click Next to accept the default naming of the file resource.

The Controls & Resources page reappears, showing the addition of both resources referenced in the main JRXML.

10. Click Data Source and define a data source as described in the next section.

Referencing Styles

You can apply a style to your report by referencing a property sheet, created in iReport, that contains information on a style.

To do this, you will need to edit the Styles.jrxml file and change the <templates> statement.

To reference styles from an external property sheet:

1. Locate and open the Styles.jrxml file.
2. In the JRXML file, declare <template>"repo:styles"</template> (do not include the .jrtx extension).
3. Save the JRXML file.
4. Log into the sever as an administrator, and select View > Repository.
5. Expand the Organization > Reports folder.
6. Right-click the Samples folder and select Add Resource > JasperReport to open the Add JasperReport wizard.
7. On the Set Up page, enter the required information.
8. Select Upload a Local File and click Browse...
9. Locate Styles.jrxml, and click Open.
10. Click Submit.
11. Copy the base_styles.jrtx file from the directory:

<jrs-install>\ireport\demo\samples\templates\reports

and place into the C:\ directory.

12. Edit the styles.jrtx file and add C:\\ before base_styles.jrtx.
13. Back on the server, select View > Repository, then expand the Organization folder.
14. Right-click Images, and select Add Resource > File > Style Template.
15. Under Path to File,click Browse... then locate the style.jrtx file.
16. Enter a Name (Styles) and click Submit.
17. In the repository, open the Reports > Styles folder, then right click on Styles report and select Edit.
18. Click Control & Resources, then click the Add Resource... link.
19. Select Select a resource from the Repository radio button, Browse...
20. Locate Organization > Images > Styles, and click Select.
21. Click Next button
22. On the Add a Report Resource screen, enter Name: Styles, then click Next.
23. Click Submit
Feedback
randomness