poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47661] New: Lost data after opening and saving as another file
Date Fri, 07 Aug 2009 10:58:23 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=47661

           Summary: Lost data after opening and saving as another file
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: duc.nguyen@sds.com.vn


--- Comment #0 from Duc Nguyen <duc.nguyen@sds.com.vn> 2009-08-07 03:58:21 PDT ---
Created an attachment (id=24118)
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();
        }
    }

}

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


Mime
View raw message