Bug 45129

Summary: Lost picture in file output after saving with POI
Product: POI Reporter: Duc Nguyen <duc.nguyen>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal CC: duc.nguyen, sbrunot
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Bug Depends on:    
Bug Blocks: 53010    
Attachments: Original Input excel
Output excel

Description Duc Nguyen 2008-06-04 05:23:37 UTC
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 ?
Comment 1 Duc Nguyen 2008-06-04 05:24:28 UTC
Created attachment 22072 [details]
Output excel
Comment 2 Duc Nguyen 2008-06-04 05:27:19 UTC
I'm using POI 3.1-BETA2 Released (2008-05-28)
Comment 3 Evgeniy Berlog 2012-08-19 20:58:06 UTC
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