Jasper报告图像路径 [英] Jasper report image paths

查看:134
本文介绍了Jasper报告图像路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的jasper报告中插入图片,摆动应用程序。所有图像都在一个包中。我想在jasper report中设置图像的路径。这意味着,设置项目图像的路径。当整个项目位置发生变化时,会有一个例外,表示没有找到图像。请告诉我如何设置图片路径。

I want to insert images in my jasper report ,swing application. All images are in one package. I want to set path for images in jasper report.That means, to set project images's paths.When the entire project location is changed, there is an exception saying no images found. Please let me know how to set the image paths.

项目结构:
MyProject

| -Source Packages

Project structure: MyProject
|-Source Packages

源码包下

| -Images //我的图片在这里

| -Reports //我的jasper报告在哪里? >
| -MyJFrames
|

under source package
|-Images // my images are in here
|-Reports // where my jasper reports are in
|-MyJFrames |

推荐答案

你还没有发布很多细节,但我跑了使用Jasper Report处理绝对/相对路径时遇到类似的问题。

You haven't posted many particulars, but i have ran into a similar issue when dealing with absolute/relative paths with Jasper Report.

有一个已知的不适或错误(如果你想这样称呼它)使用Jasper Report无法设置或使用项目资源(子报表,图像等)的相对路径,尤其是在使用IREPORT设计器工具编译报表时。

There is a known "discomfort" or a bug (if you want to call it that way) with Jasper Report not being able to set or use relative paths to your project resources (subreports, images etc) especially if you are compiling the reports with the IREPORT designer tool.

我正在使用jasper报告和IREPORT 4.1.1,每次我将JRXML编译成.jasper文件时,我的路径都是绝对的。当整个项目移动到另一台机器时,这会导致破坏。为了使用我的报告的相对路径,我必须通过编程方式编译报告,即在我的Java应用程序中。简而言之,我正在使用的java实用程序方法读取JRXML文件并用相对路径替换绝对路径,然后编译报告。

I am working with jasper report and IREPORT 4.1.1 and every time i compile the JRXML to a .jasper file, my paths are absolute. This causes "havoc" when the whole project is moved to a different machine. In order to use relative paths to my reports i have to compile the reports via programming means i.e in my Java application. In a nutshell, the java utility method i am using reads the JRXML file and substitutes the absolute path with a relative path and then compiles the report.

看看这个论坛,它有一些不同的答案,如何做到这一点。

Take a look at this forum, which has some different answers of how to do it.

http://forums.devshed.com/java-help-9/relative-path-for-subreport-in-jasperreport-309313.html

这篇关于Jasper报告图像路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆