lswx2016 Posted March 16, 2017 Share Posted March 16, 2017 When i exported the xlsx file and opened it,Excel reminds me found the error and need to recover it.Then the file could be opened,but got the warning.The infmation is: A repaired record : The format of the /xl/styles.xml part (style)The Code pasted below:public void generateReportEXCEL (List<JasperPrint> jasperPrintList,String[] names, HttpServletRequest req, HttpServletResponse resp) throws IOException, JRException {resp.reset();resp.resetBuffer();resp.setContentType("application/vnd.ms-excel");resp.setHeader("Content-Disposition", "attachment;filename="test.xlsx"");ServletOutputStream outputStream = resp.getOutputStream(); JRXlsxExporter exporter = new JRXlsxExporter();exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(outputStream));SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration(); configuration.setDetectCellType(true);//Set configuration as you like it!!configuration.setCollapseRowSpan(false);configuration.setWhitePageBackground(false);configuration.setSheetNames(names); exporter.setConfiguration(configuration); exporter.exportReport();outputStream.flush();outputStream.close();} 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