When I opened your template file “Filter.xls” into MS Excel 2010/2013 (MS Excel 2007 also shows data lost error), I got the same error, see the screenshot for your reference:
Ok, I did save to XLS file format now. I observed the issue as you mentioned by simply opening and re-saving your attached XLS file. I found the output file (attached) is opened in Protected view after re-saving the template file, see the screenshot of the output XLS file:
Workbook workbook = new Workbook(“Filter.xls”); workbook.save(“out1.xls”);
Please note and as I mentioned earlier when I opened your original template file “Filter.xls” into MS Excel 2010/2013 (MS Excel 2007 also shows data lost error) it gives similar Protected view error too. I have logged an investigation ticket with an id “CELLSJAVA-42181” for your issue. We will look into it soon.
Once we have an update on it, we will let you know here.
This is to inform you that we have fixed your issue “CELLSJAVA-42181” now. We will soon provide the fix after performing QA and including other enhancements and fixes.
You are right, I can still find the issue with your new file “Filter_2.xls”. I found the output file is opened in Protected view after re-saving it. I have reopened the issue “ELLSJAVA-42181” again. We will look into it soon.
This is to inform you that we have fixed your issue. We will soon provide/share the fix after performing QA by applying more measures and including other enhancements and fixes.
The issue is always present using SheeRender class. It seems that it corrupts the document.
Java Code: Workbook workbook = new Workbook(filepath);
for (int i = 0; i<workbook.getWorksheets().getCount(); i++) { Worksheet worksheet = workbook.getWorksheets().get(i); ImageOrPrintOptions printOpts = new ImageOrPrintOptions(); SheetRender sr = new SheetRender(worksheet, printOpts); }
I could not reproduce the issue using your both template files (“Filter.xls” and “Filter_2.xls”) with the following sample code. The output file is fine and does not open in Protected View or is not corrupt.
e.g
Sample code:
//Workbook workbook = new Workbook(“Filter.xls”);
Workbook workbook = new Workbook(“Filter_2.xls”);
for (int i = 0; i<workbook.getWorksheets().getCount(); i++) {
You are right as I tested using the following sample code with your template file, I can still find the issue with your new file “Filter_3.xls”. I found the output file is opened in Protected view after re-saving it.
e.g
Sample code:
Workbook workbook = new Workbook(“Filter_3.xls”);
for (int i = 0; i<workbook.getWorksheets().getCount(); i++) {
Good to hear that your issue is sorted out by the new fix/version. Feel free to write us back if you have further comments or questions, we will be happy to assist you soon.