#1 2014-10-26 10:18:54

ghadjiyiannis
Member
Registered: 2014-10-26

JasperReports additional resources (styles and images)

Hi everyone,

I have created a large Jasper report containing a number of subreports, a style sheet (jrtx file) and a bunch of images. It all works fine in my eclipse environment. However, when I upload it to ReportServer, I can upload the subreports with it, but have no way of uploading the style sheet or the images. Needless to say that when I try to preview the report in ReportServer, it fails with an error message saying it could not find the style sheet.

Does ReportServer support these additional resources or only subreports? If does, how do I upload them?

Thanks,
George

Last edited by ghadjiyiannis (2014-10-26 10:19:32)

Offline

#2 2014-10-26 10:28:29

Marcel Berger
InfoFabrik
Registered: 2012-03-14
Website

Re: JasperReports additional resources (styles and images)

Hi George,

you can upload files in a internal fileserver and reference it by url. Look at adminstration -> fileserver.

More information about the file server will you find in the admin guide.


greetings,

Marcel

Offline

#3 2014-10-26 17:54:37

ghadjiyiannis
Member
Registered: 2014-10-26

Re: JasperReports additional resources (styles and images)

Many thanks Marcel!

Your approach indeed works, but I did not implement it exactly as suggested. Since other users might find this answer useful, I figured I should give a bit more information.

The reason why I modified the approach a bit is because the Filesystem component of ReportServer uses IDs instead of filenames as below:

http://localhost/reportserver/reportserver/fileServerAccess?&id=226

This is not very portable and is quite error prone. But since my ReportServer runs within a tomcat instance, I simply added a directory called "ReportResources" and under that a directory "images" and a directory "styles". That way I could have URLs of the form:

http://localhost/reportserver/ReportResources/images/image1.jpg

Then, in my report I define a parameter "ResourceRoot" and use the expression

$P{ResourceRoot} + "/images/image1.jpg"

to refer to the location of the image. In my ReportServer I define the parameter "ResourceRoot" to be hidden and non-editable, and give it a default value of "http://localhost/reportserver/ReportResources". That makes sure all of this works in my ReportServer environment.

In my case, I don't want to have ReportServer (and tomcat) running at all times (laptop with limited memory) but I still want my development environment to work. In my development environment, I recreate the structure of the ReportResources directory in the workspace where I have the report (a folder called "ReportResources" at the same level as the report jrxml containing "images" and "styles" directories). Then I set the default value of the "ResourceRoot" parameter in the report itself to be something like:

file:///path/to/workspace/ReportResources

This way the preview of the development environment uses the local files.

One note: when trying to set the URL of a Style Template Reference, the dialog window that comes up does not seem to like complex expressions such as the one shown above. However, if you create a reference pointing just anywhere, then edit the expression within the properties tab of the reference, it all works fine.

Hope that helps,
George

PS: Thanks again Marcel.

Offline

#4 2014-10-26 18:04:42

Thorsten J. Krause
Guest

Re: JasperReports additional resources (styles and images)

Hi George,

although you already found a solution let me just add to other options to access resources stored in reportservers fileserver:
(1) using the fileServerAccess-url you can instead of specifying the id, set a path-parameter.
(2) you can use the rsfs://-protocol and access fileserver-content via its internal url e.g. rsfs:///path/in/fileserver (triple-slash)

Cheers,
Thorsten

#5 2014-10-27 07:26:07

ghadjiyiannis
Member
Registered: 2014-10-26

Re: JasperReports additional resources (styles and images)

Thanks Thorsten!

I will have to try that. I am (as you can probably tell) just starting on ReportServer so I don't know the best ways of doing anything yet. But the more I see of it, the more I like it! I find it significantly better than a number of the other products I have tried.

Cheers,
George

Offline

Board footer

Powered by FluxBB