|
|
@ -94,7 +94,7 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor { |
|
|
|
|
|
|
|
|
|
|
|
Object realData; |
|
|
|
Object realData; |
|
|
|
if (data instanceof FillWrapper) { |
|
|
|
if (data instanceof FillWrapper) { |
|
|
|
FillWrapper fillWrapper = (FillWrapper)data; |
|
|
|
FillWrapper fillWrapper = (FillWrapper) data; |
|
|
|
currentDataPrefix = fillWrapper.getName(); |
|
|
|
currentDataPrefix = fillWrapper.getName(); |
|
|
|
realData = fillWrapper.getCollectionData(); |
|
|
|
realData = fillWrapper.getCollectionData(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -106,7 +106,7 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor { |
|
|
|
// processing data
|
|
|
|
// processing data
|
|
|
|
if (realData instanceof Collection) { |
|
|
|
if (realData instanceof Collection) { |
|
|
|
List<AnalysisCell> analysisCellList = readTemplateData(templateCollectionAnalysisCache); |
|
|
|
List<AnalysisCell> analysisCellList = readTemplateData(templateCollectionAnalysisCache); |
|
|
|
Collection collectionData = (Collection)realData; |
|
|
|
Collection collectionData = (Collection) realData; |
|
|
|
if (CollectionUtils.isEmpty(collectionData)) { |
|
|
|
if (CollectionUtils.isEmpty(collectionData)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -156,9 +156,23 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
sheet.shiftRows(maxRowIndex + 1, lastRowIndex, number, true, false); |
|
|
|
sheet.shiftRows(maxRowIndex + 1, lastRowIndex, number, true, false); |
|
|
|
for (AnalysisCell analysisCell : templateAnalysisCache.get(currentUniqueDataFlag)) { |
|
|
|
|
|
|
|
if (analysisCell.getRowIndex() > maxRowIndex) { |
|
|
|
// The current data is greater than unity rowindex increase
|
|
|
|
analysisCell.setRowIndex(analysisCell.getRowIndex() + number); |
|
|
|
String tablePrefix = tablePrefix(currentUniqueDataFlag); |
|
|
|
|
|
|
|
increaseRowIndex(templateAnalysisCache, number, maxRowIndex, tablePrefix); |
|
|
|
|
|
|
|
increaseRowIndex(templateCollectionAnalysisCache, number, maxRowIndex, tablePrefix); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void increaseRowIndex(Map<String, List<AnalysisCell>> templateAnalysisCache, int number, int maxRowIndex, |
|
|
|
|
|
|
|
String tablePrefix) { |
|
|
|
|
|
|
|
for (Map.Entry<String, List<AnalysisCell>> entry : templateAnalysisCache.entrySet()) { |
|
|
|
|
|
|
|
if (!tablePrefix.equals(tablePrefix(entry.getKey()))) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for (AnalysisCell analysisCell : entry.getValue()) { |
|
|
|
|
|
|
|
if (analysisCell.getRowIndex() > maxRowIndex) { |
|
|
|
|
|
|
|
analysisCell.setRowIndex(analysisCell.getRowIndex() + number); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -167,7 +181,7 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor { |
|
|
|
Integer relativeRowIndex) { |
|
|
|
Integer relativeRowIndex) { |
|
|
|
Map dataMap; |
|
|
|
Map dataMap; |
|
|
|
if (oneRowData instanceof Map) { |
|
|
|
if (oneRowData instanceof Map) { |
|
|
|
dataMap = (Map)oneRowData; |
|
|
|
dataMap = (Map) oneRowData; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
dataMap = BeanMap.create(oneRowData); |
|
|
|
dataMap = BeanMap.create(oneRowData); |
|
|
|
} |
|
|
|
} |
|
|
@ -384,8 +398,7 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor { |
|
|
|
int startIndex = 0; |
|
|
|
int startIndex = 0; |
|
|
|
int length = value.length(); |
|
|
|
int length = value.length(); |
|
|
|
int lastPrepareDataIndex = 0; |
|
|
|
int lastPrepareDataIndex = 0; |
|
|
|
out: |
|
|
|
out: while (startIndex < length) { |
|
|
|
while (startIndex < length) { |
|
|
|
|
|
|
|
int prefixIndex = value.indexOf(FILL_PREFIX, startIndex); |
|
|
|
int prefixIndex = value.indexOf(FILL_PREFIX, startIndex); |
|
|
|
if (prefixIndex < 0) { |
|
|
|
if (prefixIndex < 0) { |
|
|
|
break out; |
|
|
|
break out; |
|
|
@ -515,4 +528,8 @@ public class ExcelWriteFillExecutor extends AbstractExcelWriteExecutor { |
|
|
|
return prefix + "-" + wrapperName; |
|
|
|
return prefix + "-" + wrapperName; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String tablePrefix(String uniqueDataFlag) { |
|
|
|
|
|
|
|
return uniqueDataFlag.substring(0, uniqueDataFlag.indexOf("-") + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|