2

I want to write a jasper reports application. It has to arrange an image and a text such that they will be appropriately placed. This is what I want.

capture

I get images and texts from a web service, so I can fetch image size on runtime. If its width is bigger the text should be below, and vice versa. I tried setting width option by a parameter, but it did not work.

How can i do it?

akaya
  • 1,140
  • 9
  • 27

1 Answers1

3

Correct: You cannot set the image width using a parameter.

The quickest solution is probably like this:
Determine what your maximum width is. Then use a 'Print when expression' to display either the picture-next-to-text layout or the picture-above-text layout. Your report will have 2 image elements and 2 text elements, but you'll choose which one to display based on the image size.

An alternative would be to investigate something like Dynamic Jasper. That's a project designed to dynamically generate the .jrxml on the fly, so it has the ability to modify the width similar to what you're describing.

mdahlman
  • 9,204
  • 4
  • 44
  • 72