parthbhagat Posted August 23, 2010 Share Posted August 23, 2010 Hi All, I am using jasperreports 3.7.1. In that I am trying to export my data in .xls format using JExcelApiExporter. Export is working fine. What I want is the functionality of Microsoft Excel's grouping of data. As in Excel, by selecting entries to be grouped, go to Data -> Group & select row or column, & then you will see collapse button for that many of rows/columns on left most side. Please find the attached image for more detail. I am trying to do the same in the report. But not done yet. Can any one help me out? Thanking you,Parth Bhagat. Link to comment Share on other sites More sharing options...
Teodor Danciu Posted August 23, 2010 Share Posted August 23, 2010 Hi, This RFE is currently tracked here:http://jasperforge.org/projects/jasperreports/tracker/view.php?id=2764 Please post your comments there and give us your feedback about how this functionality should work or be configured inside a report template at design time. Thank you,Teodor Link to comment Share on other sites More sharing options...
parthbhagat Posted August 25, 2010 Author Share Posted August 25, 2010 Hi Teodor, Thank you for the reply.I tried this with Jasper Reports, but not found anything for row grouping in Excel. I think this functionality is not implemented with Jasper Reports 3.7.4. But I found an alternate way to do the same.I used POI APIs for row grouping of data in Excel. It provides simple way to group, but very tedious designs of reports in it.Here is the code for that with POI.Please provide me the feedback regarding this. Thanking you,Parth Bhagat.Code:JExcelApiExporter exporterXLS = new JExcelApiExporter();exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint);exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);ByteArrayOutputStream output = new ByteArrayOutputStream();exporterXLS.setParameter(JExcelApiExporterParameter.OUTPUT_STREAM, output);exporterXLS.exportReport();bytes = output.toByteArray();HSSFWorkbook xlsFile = new HSSFWorkbook(new ByteArrayInputStream(bytes));HSSFSheet sheet = xlsFile.getSheetAt(0);sheet.groupRow(fromRowIndex, toRowIndex);sheet.setRowGroupCollapsed(fromRowIndex, true);FileOutputStream rowGroupFileOutputStream = new FileOutputStream();xlsFile.write(rowGroupFileOutputStream); 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