I used the following short program to read an excel file and write it out again. When the template xls file has been generated by Excel 97 everything is ok. When I use the file templateXP.xls which I produced by loading template.xls into ExcelXP and saved it without any modification, I get an error message on the resulting HSSF file. The error indicates that some formatting information has got lost. The two template file (template.xls and templatexp.xls) are needed for reproducing the bug, I can provide them. public class TemplateTest { public static void main(String[] args) { HSSFWorkbook wb; try { FileInputStream template = new FileInputStream ("template.xls"); FileOutputStream result = new FileOutputStream(new File ("result.xls")); POIFSFileSystem templatefs = new POIFSFileSystem (template); wb = new HSSFWorkbook(templatefs); wb.write(result); template.close(); result.close(); template = new FileInputStream("templatexp.xls"); result = new FileOutputStream(new File ("resultxp.xls")); templatefs = new POIFSFileSystem(template); wb = new HSSFWorkbook(templatefs); wb.write(result); template.close(); result.close(); } catch (Exception e) { e.printStackTrace(); } } }
Created attachment 2755 [details] Complete sources to reproduce the bug
Awesome bug report. I'll look at this soon if someone else doesn't beat me to it.
Please download the latest nightly build and confirm that this is a problem there as well. I'm unable to reproduce this with: Excel 97 Excel 2000 using the templates provided. Office XP does not run under CrossOver Office (www.codeweavers.com) so I have no way to run it on my box (pure unadulterated linux) and we still use Office 2k at work so I do not have a way to verify under XP for certain. Thanks. -Andy
I tried it with the latest nightly build and it's gone. Thanx Martin
eeenteresting. I'm going to leave this open for now and note to follow up on it later. If we decided to do a 1.5.2 then we'll try and fix it in that branch.. . Thanks for reporting/testing!
I just tried with the latest HEAD and this is no longer a problem. Looks like it got fixed quite a while back.