Created attachment 22071 [details] Original Input excel I work on a xls with Excel XP and POI HSSF. It contains 2 images. I only open the workbook and then save it into a new xls (without any modifications). After that, I open the new workbook with MicroSoft Office Excel 2003 (11.8211.8172) S3, I got a message: "File error: Data may have been lost". I click OK. The workbook is open but there is no these images in there. Below is my code: public static void main(String[] args) { // TODO Auto-generated method stub String input = args[0]; String output = args[1]; try{ POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(input)); HSSFWorkbook workbook = new HSSFWorkbook(fs); HSSFSheet sheet = workbook.getSheetAt(0); HSSFPatriarch patriarch = sheet.createDrawingPatriarch(); System.out.println("Output: "+output); FileOutputStream fileOut = new FileOutputStream(output); workbook.write(fileOut); fileOut.close(); } catch(IOException e){ System.out.println("Can't open file "+input+" or "+output); System.exit(1); } } When I run, I got some warning messages: WARNING: 14760 bytes remaining but no space left WARNING: 14900 bytes remaining but no space left WARNING: 14900 bytes remaining but no space left What's happened ?
Created attachment 22072 [details] Output excel
I'm using POI 3.1-BETA2 Released (2008-05-28)
This problem should be fixed in trunk. Please try with a nightly build - see download links on http://poi.apache.org/ or build yourself from SVN trunk, see http://poi.apache.org/subversion.html