Poi export excel abnormal: Excel has completed file-level verification and repair. Some parts of this workbook may have been repaired or discarded

Poi export excel abnormal: Excel has completed file-level verification and repair. Some parts of this workbook may have been repaired or discarded



After exporting the table, there is this prompt, but the inspection code finds that the exception is caused by the return content set by this interface;

Solution:
Set the return type of the interface to voidexport data using response

        response.setHeader("Content-Disposition", "attachment;filename=" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1));
        response.setContentType("application/ms-excel;charset=UTF-8");
        OutputStream out = response.getOutputStream();
        wb.write(out);
        out.flush();
        out.close();

Guess you like

Origin www.cnblogs.com/ziyue7575/p/12697648.html