All,

I'm generating spreadsheets using POI 2.5.1. I'm using XP, JDK 142 04, and
writing to Excel 2002.

I have a problem with 1 of my numeric columns. I think I'm writing the
values properly.
It's working: If I open the resulting spreadsheet. I can create a new cell
adding 2 of the numeric cells and I get a proper result.
It's not working: Each cell has been annotated by Excel with a green arrow
in the upper left corner. The right click menu includes choices such as
"Number Stored As Text" and "Convert to Number". If I do convert, the arrow
goes away.
In addition, my customer needs to generate a Pivot table around this column
and is unable to do so.

I'm guessing it's the numeric format statement. 

To write each numeric cell, I do the following:

                cell = row.createCell((short) xxx);
cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); cell.setCellStyle(xxxStyle);
cell.setCellValue(xxx); where xxx varies according to the column.

Each style is defined in a common approach. Example:

        // session and transaction id
        idStyle = wb.createCellStyle();
        idStyle.setDataFormat(dataFormat.getFormat("0"));
        idStyle = this.borderTheStyle(idStyle); // borders all sides of the
cell with a thin black line
        h.put("id", idStyle); // put it in a HashMap for later access

Now, the only difference I can see between the numeric columns that work and
the one that doesn't is that the one that doesn't work uses a format that I
define: 
Format "0", and "0.0" work.

I need that column to have 3 decimal places so I use the code fragment ...
setDataFormat(dataFormat.getFormat("0.000"));

Now this isn't a default format. But it appears from the doc that I can
define a new numeric variant on the fly.

I'm assuming that this is wrong but don't know what to do instead.

Thanks for any help.

Ron Rockwell

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to