poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Burch <n...@torchbox.com>
Subject Re: how to use isADateFormat()
Date Mon, 06 Aug 2007 13:47:36 GMT
On Sat, 4 Aug 2007, Miroslav ?ulc wrote:
> I tried to figure out how to use HSSFDateUtil.isADateFormat() but didn't 
> find any info. What is not obvious to me is where should I get the 
> values for parameters of the method.

The format index is just like isInternalDateFormat takes, which you can 
get from a HSSFStyle. The format string was a bit trickier to get at, so 
I've updated HSSFStyle to also return that (via getDataFormatString)

> Also I would expect HSSFDateUtil.isCellDateFormatted() would now call 
> HSSFDateUtil.isADateFormat() but it doesn't and it still checks only 
> internal formats.

That was an oversight - isADateFormat is quite a new addition to the 
codebase. I've updated isCellDateFormatted to call this instead

> Also I'm not sure whether it is a purpose or just omission but 
> isADateFormat() will return false on datetime formats and maybe even on 
> time formats (I didn't check this yet).

I'm not sure that it should return true on pure time formats, since 
they don't nicely match onto a java date object.

Haven't tried with a datetime. If it isn't playing nicely, you could try 
adding some examples to
 	src/testcases/org/apache/poi/hssf/data/DateFormats.xls
and uploading a new version to bugzilla. We can then update 
TestHSSFDateUtil to check that these get correctly handled, and tweak the 
HSSFDateUtil code as required

Nick

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


Mime
View raw message