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
This commit is contained in:
Nick Burch 2015-05-03 07:59:18 +00:00
parent f0fe91614b
commit 6a0cc1587b
1 changed files with 6 additions and 4 deletions

View File

@ -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);