Louri,
Thanks for the code snippet. With a couple of modifications to avoid false
detections, it worked for me. I changed the condition to look for "D" and
"M" in the format to avoid confusion with "RED". This seems to work for my
application.
Thanks again,
John
Email * [EMAIL PROTECTED]
Phone * 919-254-8021
Snail * MZDA/062, IBM Corp., P.O. Box 12195, RTP, NC 27709-2195
"Iouri
Michtchenko" To: "POI Users List" <[EMAIL
PROTECTED]>
<Iouri.Michtchenk cc:
[EMAIL PROTECTED]> Subject: RE: Recognizing Dates
03/12/2003 11:45
AM
Please respond to
"POI Users List"
Hi,
I use this code:
boolean isCellDateFormatted(HSSFWorkbook book, HSSFCell cell)
{
boolean result = false;
short format = cell.getCellStyle().getDataFormat();
if (HSSFDateUtil.isValidExcelDate(cell.getNumericCellValue()))
{
if (HSSFDateUtil.isInternalDateFormat(format))
{
result = true;
}
else
{
String fmtText = book.createDataFormat().getFormat(format);
if (fmtText != null
&& ((fmtText = fmtText.toUpperCase()).indexOf("D") >= 0
|| fmtText.indexOf("M") >= 0
|| fmtText.indexOf("Y") >= 0
|| fmtText.indexOf("H") >= 0
|| fmtText.indexOf("S") >= 0))
{
result = true;
}
}
}
return result;
}
I am not sure that it works in 100% of cases.
Regards,
Iouri
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]