Fix a 1.6ism

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1069974 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2011-02-11 22:35:20 +00:00
parent b048b8422a
commit 32f9ba7a04
1 changed files with 7 additions and 2 deletions

View File

@ -494,8 +494,13 @@ public class XSSFRichTextString implements RichTextString {
}
if(startIndex > 0 && !formats.containsKey(startIndex)) {
Map.Entry<Integer, CTRPrElt> he = formats.higherEntry(startIndex); //TODO TreeMap#higherEntry is JDK 1.6 only!
if(he != null) formats.put(startIndex, he.getValue());
// If there's a format that starts later in the string, make it start now
for(Map.Entry<Integer, CTRPrElt> entry : formats.entrySet()) {
if(entry.getKey() > startIndex) {
formats.put(startIndex, entry.getValue());
break;
}
}
}
formats.put(endIndex, fmt);