Hi,
My application exploits a CSV file (encoding: ISO-8859-1) in input and uses JasperReports to generate an XLS file.
Initially I used JasperReports 3.1.3, but I upgraded to JasperReports 3.5.1 hoping that it would solve my problem, but it didn't.
The first test is OK. The CSV input file is hand-made and contain few data lines (3 records). The application produces the expected XLS file which can be open by Excel 2003 and contains the expected data.
Now, when the input file contains true business data, the XLS file is still generated, but not always readable by Excel 2003. The tests below show a very strange behaviour : sometimes Excel behaves as if it were meeting a problem of volume of data, sometimes as if data were corrupted or mis-encoded or I don't know what, and sometimes Excel can read the file.
When trying to check if the application could produce a report containing 25000 records, the resulting report was not readable by Excel. Hence, I tried to identify a record possibly responsible for the problem.
Data (Records count) => Excel
---------------------------------------------
Business-originated (1000) => OK
Business-originated (5000) => KO: Reading error
Business-originated (3935) => OK
Business-originated (3936) => KO: Reading error
I thought : line #3936 might contain something that Excel doesn't like (although I could see nothing suspicious in the data). Hence, I have isolated that line and copied it to a new input file. Then, I repeated the test with some lines before and some lines after line #3936.
Data (Records count) => Excel
---------------------------------------------
Business-originated (1) => OK (unique record identical to line #3936)
Business-originated (30) => OK (records from #3921 to #3950)
This result shows that data of line #3936 does not prevent Excel from reading the XLS file. Consequently, it doesn't seem to be an encoding issue. I thought : if the problem is not in the data, maybe it's in the number of data, so I made a new test with new hand-made data which contain exclusively the 'a' character.
Data (Records count) => Excel
---------------------------------------------
Hand-made 'a'-data (1000) => OK
Hand-made 'a'-data (5000) => OK
Hand-made 'a'-data (50000) => OK
As far as I could go, my "'a'-data" always result into a correct XLS file.
This test shows not only that volume of data should not be a problem (considering my volume of business data), but also that when data only contain characters that are common to all Character Sets, then the generated XLS is OK. Consequently, it might be an encoding issue.
As a conclusion, I don't even know how to categorize my problem, and even less find a solution.
I suppose that encoding should not be a problem : when my application reads the input file, it is specified that file encoding is ISO-8859-1, hence I guess that data read are correctly converted to UTF-16 by Java, and then the XLS export library should apply a correct conversion (to which encoding?) for Excel, right ?
Please help, any track is welcome !
I thank you very much for your interest in that issue.
As I said in the forum, I could get round this problem by using class JExcelApiExporter instead of class JRXlsExporter. However, abandoning the idea of using JRXlsExporter is not a satisfactory solution for me, because I had found a simple way to "freeze panes" using JRXlsExporter, whereas using JExcelApiExporter I have to implement a "dirty" method, by re-opening the Excel file using POI just to freeze panes.
Teodor, I took the liberty of assigning this issue to you for you asked me to create it.
Kind regards,
Tangi MAHE
Brittany
Recommended Comments