Created attachment 24118 [details] Excel file input I downloaded the package "POI 3.5 beta 6, and Office Open XML Support (2009-06-22)". I have a input file "testcase.xls", I tried to open and save as another file "newfile.xls" by POI. There is some problem when I open the file "newfile.xls" 1. When I open "newfile.xls" by MS Office 2003, I got the message: "File error: data may have been lost" before I am able to completely open the file. But some cells (from F57 to L57) in sheet "Generator" can't show exactly value like the origin input file "testcase.xls". 2. I try to open by Open Office 3.0.0, there are many cells not able to show exactly value like the origin file. For example: cells from F57 to L57 show value "#NAME?", cells from E49 to L49 show value "#N/A". Here is my source code: import org.junit.Test; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; public class ReadWriteSpeadsheetTest { @Test public void openSpreadsheet() { HSSFWorkbook wb = null; try { String xls = "input/testcase.xls"; wb = new HSSFWorkbook( new POIFSFileSystem(new FileInputStream(xls))); // Save as another file FileOutputStream fileOut = new FileOutputStream( "output/newfile.xls"); wb.write(fileOut); fileOut.close(); } catch (IOException e) { e.printStackTrace(); } } }
Created attachment 24119 [details] Excel file output
This seems to work fine with current versions of POI (at least LibreOffice displays the re-written file correctly, couldn't check on Excel), therefore I am closing this as WORKSFORME, please reopen this with updated information if it is still a problem for you.