Bug 45129 - Lost picture in file output after saving with POI
Summary: Lost picture in file output after saving with POI
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Blocks: 53010
  Show dependency tree
Reported: 2008-06-04 05:23 UTC by Duc Nguyen
Modified: 2012-08-19 20:58 UTC (History)
2 users (show)

Original Input excel (46.50 KB, application/vnd.ms-excel)
2008-06-04 05:23 UTC, Duc Nguyen
Output excel (39.00 KB, application/vnd.ms-excel)
2008-06-04 05:24 UTC, Duc Nguyen

Note You need to log in before you can comment on or make changes to this bug.
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];
			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);
		} catch(IOException e){
			System.out.println("Can't open file "+input+" or "+output);


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