Question

Virtusa
GB
Last activity: 25 Mar 2020 13:51 EDT
Excel file generated using Apache POI classes is not opening
Generated excel file from java step from pega using below code,
try ( XSSFWorkbook workbook = new XSSFWorkbook()) { FileOutputStream out = new FileOutputStream(new File("createworkbook.xlsx")); workbook.write(out); out.flush(); out.close();
Ofcourse, I have fixed all errors at compile time with above code to add full class names. The problem is , File is getting generated however, the generated excel file while opening throwing error as "Excel cannot open the file <Filename> because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file."