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 2009/09/16 09:03:41 UTC

DO NOT REPLY [Bug 47847] New: Read XLS via HSSFWorkbook and write back, file unreadable by MS Excel 2003

https://issues.apache.org/bugzilla/show_bug.cgi?id=47847

           Summary: Read XLS via HSSFWorkbook and write back, file
                    unreadable by MS Excel 2003
           Product: POI
           Version: 3.5-dev
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: henryhuang@hengtiansoft.com


Read the XlS file via HSSFWorkbook and do nothing except write the workbook
back, then the file goes unreadable by MS Excel 2003.

The following is the code:

FileInputStream fis = null;
HSSFWorkbook wb = null;
try{
    File f = new File("testUnreadable.xls");
    if (f.exists()){
        fis = new FileInputStream(f);
        wb = new HSSFWorkbook(fis);
    }
}catch (Throwable th){}
finally{
    if (fis != null){
        fis.close();
    }
}
FileOutputStream stream = null;
try{
    stream = new FileOutputStream("New.xls");
    wb.write(stream);
}catch (Exception e){}
finally{
    if (stream != null)
    {
        stream.close();
    }
}

when opening the generated "new.xls" file with MS Excel 2003, the following
error message pops up:

"Excel found unreadable content in "testUnreadablenew.xls". Do you want to
recover the contents of this workbook?..."

Is there any work around? Thanks a lot.

-- 
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


DO NOT REPLY [Bug 47847] [PATCH] Read XLS via HSSFWorkbook and write back, file unreadable by MS Excel 2003

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47847

--- Comment #3 from henry <he...@hengtiansoft.com> 2010-01-14 18:23:01 UTC ---
Verify the provided patch, the problem has been fixed:-)

Thanks a lot.

-- 
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


DO NOT REPLY [Bug 47847] [PATCH] Read XLS via HSSFWorkbook and write back, file unreadable by MS Excel 2003

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47847

henry <CH...@statestreet.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|3.5-dev                     |3.7

-- 
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


DO NOT REPLY [Bug 47847] [PATCH] Read XLS via HSSFWorkbook and write back, file unreadable by MS Excel 2003

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47847

David Fisher <df...@jmlafferty.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #7 from David Fisher <df...@jmlafferty.com> 2011-03-22 22:54:47 EDT ---
Sorry, I saw 2011 and not 2010 in Nick's comments.

It sure has been awhile. What happens if you do a "save as" in Excel with that
file?

Also, what produced your original file?

Regards,
Dave

-- 
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


DO NOT REPLY [Bug 47847] Read XLS via HSSFWorkbook and write back, file unreadable by MS Excel 2003

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47847

--- Comment #1 from henry <he...@hengtiansoft.com> 2009-09-16 00:06:27 PDT ---
Created an attachment (id=24273)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24273)
The test file

The file fails to do the read and write.

-- 
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


DO NOT REPLY [Bug 47847] [PATCH] Read XLS via HSSFWorkbook and write back, file unreadable by MS Excel 2003

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47847

henry <he...@hengtiansoft.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #5 from henry <he...@hengtiansoft.com> 2011-03-22 21:33:57 EDT ---
Verified on POI version 3.7, the issue still exists.

Will this fix be included in the POI formal release?

-- 
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


DO NOT REPLY [Bug 47847] [PATCH] Read XLS via HSSFWorkbook and write back, file unreadable by MS Excel 2003

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47847

--- Comment #8 from henry <CH...@statestreet.com> 2011-03-22 23:18:05 EDT ---
(In reply to comment #7)
> Sorry, I saw 2011 and not 2010 in Nick's comments.
> 
> It sure has been awhile. What happens if you do a "save as" in Excel with that
> file?
> 
> Also, what produced your original file?
> 
> Regards,
> Dave

The file could be saved successfully. However, trying the above code on the new
save file will still generate a corrupted file. 

The file is created manually in MS Excel 2003.

The patch provided by Nick works fine for POI-3.5, however in POI-3.7, the
implementation of the problem class "UnicodeString" seems to be totally
changed. So I am not sure whether the changes cause the issue again.

Thanks.

-- 
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


DO NOT REPLY [Bug 47847] [PATCH] Read XLS via HSSFWorkbook and write back, file unreadable by MS Excel 2003

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47847

Nick Burch <ni...@alfresco.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Nick Burch <ni...@alfresco.com> 2010-01-19 04:05:39 UTC ---
I've added support to svn for the ExtRst part of unicode strings. This should
hopefully fix the problem, because we now parse the data so can split on more
helpful positions.

-- 
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


DO NOT REPLY [Bug 47847] [PATCH] Read XLS via HSSFWorkbook and write back, file unreadable by MS Excel 2003

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47847

Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #9 from Yegor Kozlov <ye...@dinom.ru> 2011-03-23 08:42:26 EDT ---
I've just tried your code with POI trunk and it works correctly. The output is
readable by Excel 2003 and Excel 2010. 

Yegor

-- 
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


DO NOT REPLY [Bug 47847] [PATCH] Read XLS via HSSFWorkbook and write back, file unreadable by MS Excel 2003

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47847

David Fisher <df...@jmlafferty.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from David Fisher <df...@jmlafferty.com> 2011-03-22 22:50:32 EDT ---
Nick reported the issue as resolved AFTER 3.7 was released.

Does POI 3.8 beta 1 work? Does trunk work?

-- 
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


DO NOT REPLY [Bug 47847] [PATCH] Read XLS via HSSFWorkbook and write back, file unreadable by MS Excel 2003

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47847

pierre tholence <pi...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Read XLS via HSSFWorkbook   |[PATCH] Read XLS via
                   |and write back, file        |HSSFWorkbook and write
                   |unreadable by MS Excel 2003 |back, file unreadable by MS
                   |                            |Excel 2003

-- 
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


DO NOT REPLY [Bug 47847] Read XLS via HSSFWorkbook and write back, file unreadable by MS Excel 2003

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47847

--- Comment #2 from pierre tholence <pi...@gmail.com> 2010-01-13 04:58:10 UTC ---
Created an attachment (id=24836)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24836)
patch to fix bug 47847

This patch fix the problem for the test file.
The problem was coming from a wrong assumption on the ExtRst field.

-- 
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