toffer Posted November 15, 2013 Share Posted November 15, 2013 Let's say I got six images in a grid of 3x2: Now I would like to make the third image disappear by setting "printWhenExpression" to false and automatically let the fourth image take in the place of the third and the fifth of the fourth and so on:What layout type or settings do I need to use to achieve this in a Jasper Report .jrxml? Either Free/Vertical/Horizontal Layout did not work out for me. Link to comment Share on other sites More sharing options...
Java_Jasper Posted November 15, 2013 Share Posted November 15, 2013 I would start by looking at JRPrintText() net.sf.jasperreports.engine.JRPrintElementThis may lead to some help. Link to comment Share on other sites More sharing options...
Java_Jasper Posted November 15, 2013 Share Posted November 15, 2013 Check out this link for more:http://www.javadocexamples.com/net/sf/jasperreports/engine/net.sf.jasperreports.engine.JRPrintText.htmlB. Link to comment Share on other sites More sharing options...
Java_Jasper Posted November 15, 2013 Share Posted November 15, 2013 Here is the actual code for JRPrintText:http://www.javadocexamples.com/net/sf/jasperreports/engine/net.sf.jasperreports.engine.JRPrintText-source.html#line./var/www/javadocexamples.com/src/net/sf/jasperreports/engine/JRPrintText.java:37B. Link to comment Share on other sites More sharing options...
toffer Posted November 18, 2013 Author Share Posted November 18, 2013 @Java_Jasper: Thanks, but I think this cannot be applied to my issue, as I want to handle the layout of images and not text Link to comment Share on other sites More sharing options...
mrabbi Posted November 18, 2013 Share Posted November 18, 2013 Hi,the Free/Vertical/Horizontal layouts that you can set from Jaspersoft Studio is a feature of the report editor itself and not something that is related to the JasperReports Library.If you try to look at JRXML level you will see something like this inside a container (i.e: band): <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>It's Jaspersoft Studio that detecting this kind of information will provide to arrange the elements and resize them, when they are dragged or moved inside the container. The idea is to create in the future more complex layout and provide framework / api in order to allow the user to do so. But for now these are the simple ones that you can use.As far as I understood I think you should handle the showing of the images using the printWhenExpression in more images.Of course you can obtain the 2x3 grid using a Vertical Layout in the band and putting two frames. Then on each frame use the Horizontal layout with three images each.Best regards,Massimo. Link to comment Share on other sites More sharing options...
toffer Posted November 18, 2013 Author Share Posted November 18, 2013 Thanks Massimo. But when I split the images into two frames with horizontal layout, they cannot swap from one to the other, as stated in my above example (i.e. move image #4 from the lower frame to the upper one, when #3 has printWhenExpression set to false). Link to comment Share on other sites More sharing options...
toffer Posted November 18, 2013 Author Share Posted November 18, 2013 I thought of an attempt to use some kind of counter variable that goes up, every time an image is printed and then use this to calculate the position of the next image. But unfortunately it seems, that dynamic values or expressions cannot be used as x/y position values...Is there a way to maybe achieve this programatically in Java? Sorry, but I am still new to Jasper Reports. Link to comment Share on other sites More sharing options...
mrabbi Posted November 18, 2013 Share Posted November 18, 2013 Sorry in a rush I wrongly wrote printWhenExpression. I think you should manage the "Image Expression" in a custom way instead. This way you will have always the grid 2x3, but you will print the correct image in the block depending on the specific condition. Therefore it will happen that in specific cases you will have the last image expression empty/null. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now