You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Nick Burch <ap...@gagravarr.org> on 2013/12/12 05:12:31 UTC

Re: Odd behavior in POI 3.10-beta1 & java7

On Wed, 11 Dec 2013, Aram Mirzadeh wrote:
> The first 15 rows (all columns), the text of the cell is replaced with a 
> numeric value, it's the same value each time but I can't figure out where 
> it's coming from.
>
> Commenting out the cell.setCellType(Cell.CELL_TYPE_NUMERIC); does indeed fix 
> the problem.

Why are you calling setCellType(Cell.CELL_TYPE_NUMERIC) on the cells? 
Generally this isn't needed - if reading you want the type the cell 
already has, if writing you normally let POI set the type when you set the 
value

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Odd behavior in POI 3.10-beta1 & java7

Posted by Nick Burch <ap...@gagravarr.org>.
On Thu, 12 Dec 2013, Aram Mirzadeh wrote:
> On 12/11/2013 11:12 PM, Nick Burch wrote:
>>> Commenting out the cell.setCellType(Cell.CELL_TYPE_NUMERIC); does indeed 
>>> fix the problem.
>> 
>> Why are you calling setCellType(Cell.CELL_TYPE_NUMERIC) on the cells? 
>> Generally this isn't needed - if reading you want the type the cell already 
>> has, if writing you normally let POI set the type when you set the value
>
> I'm writing, but POI is setting some of them to general when they are in fact 
> numeric.   But either way the resulting behavior isn't expected right?

Cell Type != Cell Formatting

Cell Type is a low level thing about how it gets written to the file. Cell 
Formatting is about how a number gets turned into soemthing on your screen

General is one of the well known formattings. If you want a different 
formatting applied, create a cell style, set the format on that (could be 
another well known one), and apply that cell style

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Odd behavior in POI 3.10-beta1 & java7

Posted by Aram Mirzadeh <aw...@mbcli.com>.
On 12/11/2013 11:12 PM, Nick Burch wrote:
> On Wed, 11 Dec 2013, Aram Mirzadeh wrote:
>> The first 15 rows (all columns), the text of the cell is replaced 
>> with a numeric value, it's the same value each time but I can't 
>> figure out where it's coming from.
>>
>> Commenting out the cell.setCellType(Cell.CELL_TYPE_NUMERIC); does 
>> indeed fix the problem.
>
> Why are you calling setCellType(Cell.CELL_TYPE_NUMERIC) on the cells? 
> Generally this isn't needed - if reading you want the type the cell 
> already has, if writing you normally let POI set the type when you set 
> the value
>
> Nick

I'm writing, but POI is setting some of them to general when they are in 
fact numeric.   But either way the resulting behavior isn't expected right?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org