Jump to content
  • Generated XLS file unreadable by Excel


    tangi
    Assigned User teodord
    CategoryBug report
    PriorityNormal
    ReproducibilitySometimes
    ResolutionDuplicate
    SeverityCritical
    StatusClosed

    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


    Attachments: files3.zip

    User Feedback

    Recommended Comments

    We have a similar kind of problem. The report generated using jasper 3.1.4 cannot be opened in MS Excel 2000 or 2003, but can be opened in Open Office 7.0. We need a resolution to this problem asap.
    Link to comment
    Share on other sites

    Hi,

     

    Thank you for all the info you provided. We were able to get a hold of it and this is now solved on SVN. It will be part of the next release.

    The JRXlsExporter was creating too much rich text necessarily.

    The bug was introduced in 3.1.0.

     

    It was reported also here:

    http://jasperforge.org/projects/jasperreports/tracker/view.php?id=4202

     

    You could give the SVN head version a try and let us know how it went.

    I'm closing it now, but feel free to reopen if needed.

     

    Thank you,

    Teodor

     

     

    Link to comment
    Share on other sites

    We are facing the same issue for JExcelApiExporter and JRXlsExporter both on JR5.5.1 and POI3.11. The xls files don't open in Excel but opens in Openoffice/Libreoffice. Excel Shows unreadable content, and when clicked yes it says document correpted.

    I tried using JRXlsxExporter also. Using that the file still shows unreadable content, but when clicked yes it says hyperlinks removed.

    Link to comment
    Share on other sites


×
×
  • Create New...