DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40128>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40128

           Summary: HSSFDateUtil.isCellDateFormatted(cell) returns false
                    when the cell is formatted as a date
           Product: POI
           Version: 3.0-dev
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


After making sure that the cell is in numeric format:

When calling the HSSFDateUtil.isCellDateFormatted(cell) method, it returns false
for all excel date formats other than M/DD/YYYY.
  
If you use a custom date format it works but not the actual excel date format.

I believe this is because it calls the
 
isInternalDateFormat(int format) method which checks against these hex values:
 
                case 0x0e:
                case 0x0f:
                case 0x10:
                case 0x11:
                case 0x12:
                case 0x13:
                case 0x14:
                case 0x15:
                case 0x16:
                case 0x2d:
                case 0x2e:
                case 0x2f:

however these values are only for the custom date formats, not actual date 
formats.

Adding the following should recognize the actual date formats instead of only
custom ones:

Values were found through experimentation with excell's date formatting.
They correspond to the HSSFCell.getCellStyle().getDataFormat() values for excel
dates.

The format they represent is shown next to them.

      case 0xA6: // Monday, July 24, 2006
      case 0xA7: // 7/24

      case 0xA8: // 7/24/06

      case 0xA9: // 07/24/06

      case 0xAA: // 24-Jul

      case 0xAB: // 24-Jul-06


      case 0xAD: // 24-Jul-06

      case 0xAE: // Jul-06

      case 0xAF: // July-06

      case 0xB0: // July 24, 2006

      case 0xB1: // 7/24/06 12:00 AM

      case 0xB2: // 7/24/06 0:00

      case 0xB3: // J

      case 0xB4: // J-06

      case 0xB5: // 7/24/2006

      case 0xB6: // 24-Jul-2006

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/

Reply via email to