I'm trying to work on writing data to the excel file using apache POI-3.15-beta1, but when the workbook is created, the workbook becomes corrupted with lost some content which is some of the formula not working and table style is lost. If the original excel file is open while opening the updated excel, all content is there and there is no error. Other excel I tested working properly. Any suggestions of why this the problem happened and any solution?
This error popup before opening the excel: Lost content error
This popup after opening the excel when yes is clicked: Error
[Edit] Cell A1:E5: Update I just used this java code here
FileInputStream inputStream = new FileInputStream("D:/Template.xls");
Workbook workbook = null;
workbook = new HSSFWorkbook(inputStream);
inputStream.close();
Sheet sheet = workbook.getSheetAt(0);
Cell cell= sheet.getRow(1).getCell(3);
cell.setCellValue(30);
FileOutputStream out = new FileOutputStream(new File("D:/Test.xls"));
workbook.write(out);
out.close();
This is not an answer but just to say that my current problem is more or less because of two cells with data validation like this Here. The problem is the excel file cannot be changed as it won't be valid anymore to use.