Esteve Camps
Esteve Camps

Reputation: 1123

Cannot open Excel generated using poi-3.0-alpha1-20050704.jar

I coded a simple method to generate an Excel workbook. The file generated may be opened using OpenOffice but Excel2007 does not recognizes it, crashing and forcing to restart Excel.

I also have poi-scratchpad-3.0-alpha1-20050704.jar in classpath.

The code is as simple as:

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
.
.
.
workbook = new HSSFWorkbook();
sheet = workbook.createSheet();
row = sheet.createRow(currentRow);
cell = row.createCell(HEADER1_COLUMN);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setCellValue(HEADER_TEXT);

Is there any problem using given version or may I code something different?

Upvotes: 0

Views: 451

Answers (1)

Gagravarr
Gagravarr

Reputation: 48326

You seem to be running a 6.5 year old alpha version of POI! That's, well, "unusual"....

If you take a look at the POI change log and bug fix list, you'll see that in the intervening 6.5 years, there have been so many bug fixes that you'll need to scroll through about 20 pages to see a summary of them all!

You should upgrade to a much much newer version, and almost certainly all your problems will go away. If you can, upgrade to the most recent 3.8 beta, then upgrade again in a few weeks when 3.8 final is out. If not, upgrade to 3.7 final, but there's been quite a few bug fixes since then that are in the 3.8 betas, so going for 3.8 is to be recommended.

Upvotes: 1

Related Questions