diff --git a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java index e218fa7d..d25ee941 100644 --- a/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java +++ b/src/main/java/com/alibaba/excel/write/executor/ExcelWriteAddExecutor.java @@ -46,9 +46,11 @@ public class ExcelWriteAddExecutor extends AbstractExcelWriteExecutor { } // BeanMap is out of order,so use fieldList List fieldList = new ArrayList(); - for (int relativeRowIndex = 0; relativeRowIndex < data.size(); relativeRowIndex++) { + int relativeRowIndex=0; + for(Object oneRowData : data){ int n = relativeRowIndex + newRowIndex; - addOneRowOfDataToExcel(data.get(relativeRowIndex), n, relativeRowIndex, fieldList); + addOneRowOfDataToExcel(oneRowData, n, relativeRowIndex, fieldList); + relativeRowIndex++; } }