johndahl Posted June 10, 2008 Share Posted June 10, 2008 I have two jasper reports, one in landscape and other in portrait mode. Both reports use same subreport for page header which needed to be aligned in center horizontally. If the subreport is in landscape mode, it works for landscape only and same is the case with portrait mode. Can we align same subreport in center horizontally in both reports? I have removed all margins in the subreport. Thanks in advance. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted June 11, 2008 Share Posted June 11, 2008 Hi, If you have two different report templates, one portrait and one landscape, why is it that you do not align the subreport element yourself inside its containing band?In the portrait version, you put it at the left I guess, as page width is shorter. And in landscape you put it a little at the right, so that it is centered on the larger page width.You can use iReport visual designer for that. I might not understand what the actual problem is, in which case you should explain better. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
johndahl Posted July 22, 2008 Author Share Posted July 22, 2008 Sorry for my very late response.You have understood the problem correctly. And yes I have aligned the subreport correctly in the container, but I don't think it has any real effect on actual alignment of subreport elements.As far as I understand, to align the text elements horizontally center, JasperReports needs to know the width of textField. Although I have set the property "Enlarge between Margins" to the textField so that it covers the whole available width, it actually sets the width property to some calculated numerical value. The result is that if the subreport is oriented vertically, it will be correctly aligned only if used in vertically oriented report and vice versa. Currently I am using 2 subreport files as a quick and dirty solution. But I have a feeling that it can be done with just a single report.Any suggestions? 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