Browse Source

fix #506

developing
Jiaju Zhuang 5 years ago
parent
commit
7781aa41a3
  1. 8
      src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java

8
src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java

@ -266,13 +266,9 @@ public abstract class AbstractWriteHolder extends AbstractHolder implements Writ
List<WriteHandler> handlerList, Map<Class<? extends WriteHandler>, List<WriteHandler>> parentHandlerMap) { List<WriteHandler> handlerList, Map<Class<? extends WriteHandler>, List<WriteHandler>> parentHandlerMap) {
// add // add
Set<WriteHandler> noRepeatSet = new HashSet<WriteHandler>();
if (parentHandlerMap != null) { if (parentHandlerMap != null) {
for (List<WriteHandler> parentHandlerList : parentHandlerMap.values()) { handlerList.addAll(parentHandlerMap.get(WriteHandler.class));
noRepeatSet.addAll(parentHandlerList);
}
} }
handlerList.addAll(noRepeatSet);
// sort // sort
Map<Integer, List<WriteHandler>> orderExcelWriteHandlerMap = new TreeMap<Integer, List<WriteHandler>>(); Map<Integer, List<WriteHandler>> orderExcelWriteHandlerMap = new TreeMap<Integer, List<WriteHandler>>();
@ -307,6 +303,7 @@ public abstract class AbstractWriteHolder extends AbstractHolder implements Writ
// classify // classify
Map<Class<? extends WriteHandler>, List<WriteHandler>> result = Map<Class<? extends WriteHandler>, List<WriteHandler>> result =
new HashMap<Class<? extends WriteHandler>, List<WriteHandler>>(16); new HashMap<Class<? extends WriteHandler>, List<WriteHandler>>(16);
result.put(WriteHandler.class, new ArrayList<WriteHandler>());
result.put(WorkbookWriteHandler.class, new ArrayList<WriteHandler>()); result.put(WorkbookWriteHandler.class, new ArrayList<WriteHandler>());
result.put(SheetWriteHandler.class, new ArrayList<WriteHandler>()); result.put(SheetWriteHandler.class, new ArrayList<WriteHandler>());
result.put(RowWriteHandler.class, new ArrayList<WriteHandler>()); result.put(RowWriteHandler.class, new ArrayList<WriteHandler>());
@ -321,6 +318,7 @@ public abstract class AbstractWriteHolder extends AbstractHolder implements Writ
} else if (writeHandler instanceof WorkbookWriteHandler) { } else if (writeHandler instanceof WorkbookWriteHandler) {
result.get(WorkbookWriteHandler.class).add(writeHandler); result.get(WorkbookWriteHandler.class).add(writeHandler);
} }
result.get(WriteHandler.class).add(writeHandler);
} }
return result; return result;
} }

Loading…
Cancel
Save