How to dynamically pass Images?

By: keodark - keodark
How to dynamically pass Images?
2005-08-02 09:01
I'd like to pass in dynamic (Java-generated) Image objects to a report. I can't use parameters because there are an arbitrary (user-defined at runtime) number of different image objects.

However, it seems that a field from my datasource cannot contain an Image object... it's not in the list of accepted classes, and when I try using an Object field and casting it (everywhere) to an Image, I get a ClassCastException. It's not good enough to pass in an image's file location, because some images will be drawn in Java on-the-fly.

Ideas?




By: John Zoetebier - johnzoet
RE: How to dynamically pass Images?
2005-08-02 14:41
>However, it seems that a field from my datasource cannot contain an Image object...

JRDataSource.getFieldValue(JRField jrField)
returns java.lang.Object

You can return any type of object in JRDataSource.
2004 IR Help's picture
Joined: Aug 17 2006 - 3:49am
Last seen: 15 years 9 months ago

2 Answers:

Very good question.
I wonder who will provide a working example...
aacoro's picture
-1
Joined: Jan 17 2011 - 2:43am
Last seen: 11 years 4 months ago

2 options

1. Use scriptlet

2. Use a class to do it.

The first choice it's better



bestofwest's picture
Joined: Jan 14 2011 - 1:54pm
Last seen: 7 years 5 months ago
Feedback