From 7781aa41a3e2669d69a74033603f6366586f23fd Mon Sep 17 00:00:00 2001 From: Jiaju Zhuang Date: Wed, 28 Aug 2019 09:27:38 +0800 Subject: [PATCH] fix #506 --- .../excel/write/metadata/holder/AbstractWriteHolder.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 adaf840..566a4e6 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; }