<!-- Don't forget to update status.xml too! -->
<release version="3.1-final" date="2008-06-??">
+ <action dev="POI-DEVELOPERS" type="fix">45087 - Correctly detect date formats like [Black]YYYY as being date based</action>
<action dev="POI-DEVELOPERS" type="add">45060 - Improved token class transformation during formula parsing</action>
<action dev="POI-DEVELOPERS" type="add">44840 - Improved handling of HSSFObjectData, especially for entries with data held not in POIFS</action>
<action dev="POI-DEVELOPERS" type="add">45043 - Support for getting excel cell comments when extracting text</action>
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.1-final" date="2008-06-??">
+ <action dev="POI-DEVELOPERS" type="fix">45087 - Correctly detect date formats like [Black]YYYY as being date based</action>
<action dev="POI-DEVELOPERS" type="add">45060 - Improved token class transformation during formula parsing</action>
<action dev="POI-DEVELOPERS" type="add">44840 - Improved handling of HSSFObjectData, especially for entries with data held not in POIFS</action>
<action dev="POI-DEVELOPERS" type="add">45043 - Support for getting excel cell comments when extracting text</action>
// switching stuff, which we can ignore
fs = fs.replaceAll(";@", "");
- // If it starts with [$-...], then it is a date, but
+ // If it starts with [$-...], then could be a date, but
// who knows what that starting bit is all about
- fs = fs.replaceAll("\\[\\$\\-.*?\\]", "");
+ fs = fs.replaceAll("^\\[\\$\\-.*?\\]", "");
+
+ // If it starts with something like [Black] or [Yellow],
+ // then it could be a date
+ fs = fs.replaceAll("^\\[[a-zA-Z]+\\]", "");
// Otherwise, check it's only made up, in any case, of:
// y m d h s - / , . :
// (who knows what they mean though...)
"[$-F800]dddd\\,\\ mmm\\ dd\\,\\ yyyy",
"[$-F900]ddd/mm/yyy",
+ // These ones specify colours, who knew that was allowed?
+ "[BLACK]dddd/mm/yy",
+ "[yeLLow]yyyy-mm-dd"
};
for(int i=0; i<formats.length; i++) {
- assertTrue( HSSFDateUtil.isADateFormat(formatId, formats[i]) );
+ assertTrue(
+ formats[i] + " is a date format",
+ HSSFDateUtil.isADateFormat(formatId, formats[i])
+ );
}
// Then time based ones too
"mm/dd HH:MM PM", "mm/dd HH:MM pm"
};
for(int i=0; i<formats.length; i++) {
- assertTrue( HSSFDateUtil.isADateFormat(formatId, formats[i]) );
+ assertTrue(
+ formats[i] + " is a datetime format",
+ HSSFDateUtil.isADateFormat(formatId, formats[i])
+ );
}
// Then invalid ones
"yyyy*mm*dd",
"0.0", "0.000",
"0%", "0.0%",
+ "[]Foo", "[BLACK]0.00%",
"", null
};
for(int i=0; i<formats.length; i++) {
- assertFalse( HSSFDateUtil.isADateFormat(formatId, formats[i]) );
+ assertFalse(
+ formats[i] + " is not a date or datetime format",
+ HSSFDateUtil.isADateFormat(formatId, formats[i])
+ );
}
// And these are ones we probably shouldn't allow,