drummer54 Posted May 7, 2015 Share Posted May 7, 2015 I have reports that must be included in sets, thus the use of subreports, and that must be exported to Excel so that our CEO and clients can sort the data to their liking. I've been able to mostly remove unwanted cell merging using the net.sf.jasperreports.export.xls.column.width property, but only when exporting the report as the main report. When the report is included as a subreport and exported the numerous unwanted cell merges occur. Is there any way to rectify this?Image of report exported as subreport:Image of report exported as main report, with manageable cell merges: Link to comment Share on other sites More sharing options...
butlerc Posted May 11, 2015 Share Posted May 11, 2015 I couldn't see a problem on the files you attached - although it's hard to paste files on here.Mergin of cells is mostly down to bad report design.If your using subreports, try to plan ahead and use the same size column widths and make sure you allign the subreports in sync in your master. Excel will create a merge of cells if any of cells in your reports overlap.For example if in main report column 1 has width of 100, col2 width 100 and in subreport 1 column 1 has width of 50, col 1 width 100 this will cause a merge to occur in excel because your reports are not alligned. Hope this helps Link to comment Share on other sites More sharing options...
drummer54 Posted May 18, 2015 Author Share Posted May 18, 2015 So it affects subreports in Excel even if the subreports are saved to different worksheets? What if the data being presented in each report doesn't lend itself to identical column widths? SQL Server Reporting Services doesn't have this problem. Not that I think it's an especially good tool, because it has a lot of faults, but it does handle creation of Excel columns well.The only way I have figured out how to mitigate this effect is to move all of my column headings into the title bar, make a single field with the date/time and place it over a data column that is the same width as the date/time field, and make certain that the report title is the same width as the data column under it. All of this seems to be an unnecessary restriction - again, SSRS handles this quite well. Our standard is that the report title is placed at the top left and the date/time is placed at the top right of the report. If I have a long report title (and we have many that are rather lengthy) or a right most data column that is very narrow (narrower than required by the date/time stamp), it fouls up the cells when exporting to Excel. Or we define cell widths just to accommodate this "bad programming" (vs bad report design) whether it fits the data or not. Link to comment Share on other sites More sharing options...
drummer54 Posted May 26, 2015 Author Share Posted May 26, 2015 I have to say it is really ridiculous that the subreports have to have the same number of columns and that the columns all have to be the same width to get this to work properly. I've also tried using tables to achieve this and the behavior is the same - if the tables either have a different number of columns or if the column widths differ then you get merged cells that prevent the user from sorting, even though each table, as is the case with the subreports, is being saved to a different worksheet. SSRS can handle this so I don't see where it's a fault of Excel, it's something in JasperReports. 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