diff --git a/src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java b/src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java index adaf840b..566a4e62 100644 --- a/src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java +++ b/src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java @@ -266,13 +266,9 @@ public abstract class AbstractWriteHolder extends AbstractHolder implements Writ List handlerList, Map, List> parentHandlerMap) { // add - Set noRepeatSet = new HashSet(); if (parentHandlerMap != null) { - for (List parentHandlerList : parentHandlerMap.values()) { - noRepeatSet.addAll(parentHandlerList); - } + handlerList.addAll(parentHandlerMap.get(WriteHandler.class)); } - handlerList.addAll(noRepeatSet); // sort Map> orderExcelWriteHandlerMap = new TreeMap>(); @@ -307,6 +303,7 @@ public abstract class AbstractWriteHolder extends AbstractHolder implements Writ // classify Map, List> result = new HashMap, List>(16); + result.put(WriteHandler.class, new ArrayList()); result.put(WorkbookWriteHandler.class, new ArrayList()); result.put(SheetWriteHandler.class, new ArrayList()); result.put(RowWriteHandler.class, new ArrayList()); @@ -321,6 +318,7 @@ public abstract class AbstractWriteHolder extends AbstractHolder implements Writ } else if (writeHandler instanceof WorkbookWriteHandler) { result.get(WorkbookWriteHandler.class).add(writeHandler); } + result.get(WriteHandler.class).add(writeHandler); } return result; }