diff options
author | Nick Burch <nick@apache.org> | 2015-05-03 07:59:18 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2015-05-03 07:59:18 +0000 |
commit | 6a0cc1587b756876e6e52af5ec6f8be286a72cc8 (patch) | |
tree | 75868c7ab91bfd44ff569313b07589ac55b6a0b2 /src | |
parent | f0fe91614b3f083349ed2b443a95969e44b2e09c (diff) | |
download | poi-6a0cc1587b756876e6e52af5ec6f8be286a72cc8.tar.gz poi-6a0cc1587b756876e6e52af5ec6f8be286a72cc8.zip |
Ensure consistent ordering when writing out formats following changes in r1677368
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1677370 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java b/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java index 80b3a9ea93..3937e3eeab 100644 --- a/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java +++ b/src/ooxml/java/org/apache/poi/xssf/model/StylesTable.java @@ -378,10 +378,12 @@ public class StylesTable extends POIXMLDocumentPart { // Formats CTNumFmts formats = CTNumFmts.Factory.newInstance(); formats.setCount(numberFormats.size()); - for (Entry<Integer, String> fmt : numberFormats.entrySet()) { - CTNumFmt ctFmt = formats.addNewNumFmt(); - ctFmt.setNumFmtId(fmt.getKey()); - ctFmt.setFormatCode(fmt.getValue()); + for (int fmtId=0; fmtId<usedNumberFormats.length; fmtId++) { + if (usedNumberFormats[fmtId]) { + CTNumFmt ctFmt = formats.addNewNumFmt(); + ctFmt.setNumFmtId(fmtId); + ctFmt.setFormatCode(numberFormats.get(fmtId)); + } } styleSheet.setNumFmts(formats); |