gorfimus Posted February 14, 2012 Share Posted February 14, 2012 I ave a crosstab table in one of my jasper reports and I want to center it horizontally. The number of columns in my crosstab table is of course dynamic, so I need a way to center it regardless of the number of columns.Is this possible? And if so, how? Link to comment Share on other sites More sharing options...
mennei Posted February 19, 2012 Share Posted February 19, 2012 Have you tried to place the crosstab in frame that is centeral in the main report, so the crosstab is subreport. Try to place the crosstab element in the left-top of this subreport, so at the minimum data it will be in the center of the report. Link to comment Share on other sites More sharing options...
gorfimus Posted February 21, 2012 Author Share Posted February 21, 2012 Thanks for the suggestion. I'm not sure it would work. I already have the crosstab as a subreport and I'm not sure placing the subreport in a frame would make a difference. I don't see any special positioning properties of a frame element that couldn't already be used by a subreport element. I could be mistaken though?I ended up solving this by creating multiple subreports. For my situation, the number of columns in my crosstab can only vary between 3 and 8 columns, so I have 6 different subreports. Given the number of columns, I know the actual width of the crosstab when it has 3 columns, 4 columns, etc, so each subreport starts the crosstab at the appropriate x coordinate for its number of columns. The main report then selects the correct subreport to render, depending on the number of columns in the crosstab. Link to comment Share on other sites More sharing options...
mennei Posted February 21, 2012 Share Posted February 21, 2012 How did you configure the main report to select the right subreport?Thank you for share it here. Link to comment Share on other sites More sharing options...
gorfimus Posted February 21, 2012 Author Share Posted February 21, 2012 I used concatenation in the subreportExpression. The query of the main report determines the number of columns and stores it in a field. I then use that field in the subreportExpression.Example:<subreport> ... <subreportExpression><![CDATA["subreportName" + $F{columns} + ".jrxml"]]></subreportExpression></subreport> Link to comment Share on other sites More sharing options...
aleksandras Posted April 13, 2012 Share Posted April 13, 2012 It is possible please see:http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=71412 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