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 c76db74929
commit 16d2e7881a

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