Bug 53323 - Saving file with SXSSF produce a file that is not read corectly with XFFS
Summary: Saving file with SXSSF produce a file that is not read corectly with XFFS
Status: RESOLVED DUPLICATE of bug 52972
Alias: None
Product: POI
Classification: Unclassified
Component: SXSSF (show other bugs)
Version: 3.8-FINAL
Hardware: PC All
: P5 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-30 07:14 UTC by Lucian Curelaru
Modified: 2015-03-23 21:00 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lucian Curelaru 2012-05-30 07:14:09 UTC
I work on an aplication which exports/imports data from/to XLS files using POI. The reading is implemented using event model the the writing of excels is using usermodel. Recently we decided to add XLSX suport. Firstly I made the export using XSSF and it worked fine. But after that have the ideea to use SXSSF because we are sometimes dealing with huge data amounts. At the first test all seemed fine, but when I tried one of the unittests I discovered a strage behiviour. 
That unit test is creating a sample file using the export function and afterthat is importing it with our import function and checks if content is the same. I discovered that same export code is working fine when using HSSF or XSSF but is not working properly when exporting with SXSSF. I notice that:
 - The file exported with SXSSF can be open with excel and looks ok. 
 - Same file can be imported with XSSF but it imports as a excel with the correct number of rows but with no cells on it
 - If I just open the file with Excel and save it ( whithout changing anything ) the import will work fine ( so the problem seems to be fixed - so I presumed that something is not saved correctly there )
 - using XSSF to export with same code works also fine.
 - the export and neither the import code does not throw any error or exception
I checked the code and compare it with examples and seems ok.
The file I save is pretty simple. It have only one sheet containg 3 columns and 100 rows which are filed with numbers formated as richtext strings.

Is there any workaround to avoid this problem for POI 3.8?
Comment 1 Yegor Kozlov 2012-05-30 08:03:34 UTC
> - Same file can be imported with XSSF but it imports as a excel with the correct > number of rows but with no cells on it

So you export data with SXSSF, read it back with XSSF and it does not see cells on the rows, right? If so, a unit test please! Without a sample code it is hard to tell what is wrong. It might be a bug in POI or a bug in your unit test.
Comment 2 Lucian Curelaru 2012-05-30 08:09:44 UTC
Please see my last comment. It seems we wrote the coments in the same time :)
Comment 3 Lucian Curelaru 2012-05-30 10:12:17 UTC
Oops.. it seems my second comment has been lost.
So... I'll write it again.
In the mean time I've done some debugging and find out that the problem was somehow in my import code: the inline strings tags was not properly parsed in my side.
It seems that with same unittest if I save a file with XSSF and SXSSF the result is quite diffrent . With SXSSF the richtext cells are saved as inline strings and with XSSF as shared strings. This mislead me and also the fact that opening the file with excel and save it without any modification has fixed the problem ( changed from inline to shared )
Still there is a kind of inconsistency. I expected to have same result with same input if changing from XSSF to SXSSF.
So I've switched to weak priority and enhancement level.
Comment 4 Dominik Stadler 2015-03-23 21:00:35 UTC
I think this is now mostly a duplicate of bug 52972 which talks about handling RichText string in a similar way than XSSF does.

*** This bug has been marked as a duplicate of bug 52972 ***