0
votes

I am using Apache poi library in java for generating excel report.

For generating excel report, i am reading text file which is delimited using PIPE and writing that into excel sheet.

Most of the cases say 98%, i don't see any issue. Some times the excel file generated unable to open. Says "Unreadable content".

I am fixing the issue by adding /removing one or two character(i.e XX or AA) to/from the data in the text file resolves this issue. I have compared data file of working one as well as corrupted one. I don't see any difference at all.

I am not sure what could be the reason for this issue. I don't see any exception or error while writing data in to excel file.

Datafile is thousands of lines and the source code has around 15 classes each goes around 300 to 400 lines. So, it's hard to post both. Sharing partial feed or class is not worth since the any addition/removal of character makes the sheet readable

This excel report has 10 to 15 sheets and multiple formats and cell merge as well as formula.

Does anyone have suggestion on this. Is there chance for memory issue while reading or writing. File is read line by line and written as sheet by sheet.

1
Please show us your code, input file. If not how can we helpTuyenNTA
"I am fixing the issue by adding /removing one or two character(i.e XX or AA) to/from the data in the text file resolves this issue. I have compared data file of working one as well as corrupted one. I don't see any difference at all.": And now you are really thinking that someone is here who has neither the code nor the data but nevertheless will solve your problem? That would must be a wizard, wouldn't that?Axel Richter
I know, it's really silly to ask for suggestion without source code/feed data. The reason is both are of big in size. Data file has thousands of line and source code has 15 to 20 class file excluding library files.user4130072
The best advice I can give you is to check if those extra characters cause the program to chose another branch in an if statement. Maybe one case causes the problem while the alternative case, triggered by the extra char, does the right thing.Erich Kitzmueller

1 Answers

0
votes

I went through the whole application and i could not find any trace. So i upgraded the application from Apache poi HSSF to Apache poi XSSF and refactored all the methods in the application that fixed this issue.