You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2004/03/10 16:38:32 UTC

DO NOT REPLY [Bug 27571] New: - POI corrupts Excel file beyond repair

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27571>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27571

POI corrupts Excel file beyond repair

           Summary: POI corrupts Excel file beyond repair
           Product: POI
           Version: 1.5.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Major
          Priority: Other
         Component: POI Overall
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: kim.madsen@inceptor.com


A spredsheet file is read into POI and written back with no changes. However,
once reopened in Excel, gives the below error:
 "Errors were detected in 'POIReadWriteTest.xls,' but Microsoft Excel
 was able to open the file by making the repairs listed below. Save
 the file to make these repairs permanent.
 
 Damage to the file was so extensive that repairs were not possible.
 Excel attempted to recover your formulas and values, but some data may 
 have lost or corrupted."

The bug seems similar to 19054 and 18155, but these bugs has status as fixed,
and this happened using both poi-1.5.1-final and poi-2.5-final.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19054
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18155

The test for this is really simple. I have included the test code below. I shall
be happy to supply the spreadsheet in the before and after version if required.

package com.inceptor.thirdparty;

import junit.framework.Test;
import junit.framework.TestSuite;
import junit.framework.TestCase;

import java.io.FileInputStream;
import java.io.FileOutputStream;

import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

/** Junit test case for the thread support library.
 *  This demonstrates a bug in POI.
 *  A spredsheet is read and written back without any changes.
 *  However, the written file contains error once opened in Excel:
 *
 *  "Errors were detected in 'POIReadWriteTest.xls,' but Microsoft Excel
 *  was able to open the file by making the repairs listed below. Save
 *  the file to make these repairs permanent.
 *
 *  Damage to the file was so extensive that repairs were not possible.
 *  Excel attempted to recover your formulas and values, but some data may 
 *  have lost or corrupted."
 *
 *  Notice does not happen for all spreadsheets.
 *  It may only be happening on spreadsheets over a certain size,
 *  or spreadsheets with VB code.
 *
 * @version $Id: POIReadWriteTest.java,v 1.4 2004/03/10 12:01:45 kim Exp $
 */
public class POIReadWriteTest extends TestCase {
    
    public POIReadWriteTest(String name) {
	super(name);
    }
    
    public void testReadWrite() throws Exception {
	POIFSFileSystem fs = new
            POIFSFileSystem(new 
		FileInputStream("src/test/etc/imp/com/inceptor/imp/lawuers.xls"));
	HSSFWorkbook wb = new HSSFWorkbook(fs);
	FileOutputStream fileOut = new 
	    FileOutputStream("src/test/etc/poi/POIReadWriteTest.xls" );
	wb.write( fileOut );
	fileOut.close();
    }
    
    public static void main(String args[]) { 
	junit.textui.TestRunner.run(suite());
    }
    
    public static Test suite() {
	return new TestSuite(POIReadWriteTest.class);
    }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org