You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by Fast3r1x <jo...@alternativefuse.com> on 2012/01/31 15:33:46 UTC

DATE FORMAT

Hi
for setting a cellDateValue a format the cell as follow:

s.setDataFormat(this.builder_.getWorkbook().createDataFormat().getFormat("yyyy-MM-dd"));
getCell(i,j).setCellStyle(s);
getCell(i,j).setCellValue(c);

where getCell simply get the cell

the problem is that all the cell change the format and don't keep their
original format
even numbers become dates

how can I solve this problem ?

Thanks
Regards

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/DATE-FORMAT-tp5444685p5444685.html
Sent from the POI - Dev mailing list archive at Nabble.com.

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


Re: DATE FORMAT

Posted by Nick Burch <ni...@alfresco.com>.
On Tue, 31 Jan 2012, Fast3r1x wrote:
> for setting a cellDateValue a format the cell as follow:

Note - this question is better suited to the user list than the dev list

> s.setDataFormat(this.builder_.getWorkbook().createDataFormat().getFormat("yyyy-MM-dd"));
> getCell(i,j).setCellStyle(s);
> getCell(i,j).setCellValue(c);
>
> the problem is that all the cell change the format and don't keep their 
> original format even numbers become dates

I don't know where you get your s cell style from, but my hunch is that 
you've fetched the default cell style. If you change the default one, all 
cells on the default style get updated too! You almost certainly want to 
create a new cell style, make that a date, and apply it only to your date 
cells

Nick

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