修复问题 more than 3 if/for/while/switch/try

This commit is contained in:
znxdgwx 2021-04-27 09:36:15 +08:00
parent b32865ad65
commit b923783b34

View File

@ -744,7 +744,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
* @param cellStyle 合并后单元格使用的样式可以为null * @param cellStyle 合并后单元格使用的样式可以为null
* @return this * @return this
*/ */
public ExcelWriter merge(int firstRow, int lastRow, int firstColumn, int lastColumn, Object content, CellStyle cellStyle){ public ExcelWriter merge(int firstRow, int lastRow, int firstColumn, int lastColumn, Object content, CellStyle cellStyle) {
Assert.isFalse(this.isClosed, "ExcelWriter has been closed!"); Assert.isFalse(this.isClosed, "ExcelWriter has been closed!");
CellUtil.mergingCells(this.getSheet(), firstRow, lastRow, firstColumn, lastColumn, cellStyle); CellUtil.mergingCells(this.getSheet(), firstRow, lastRow, firstColumn, lastColumn, cellStyle);
@ -883,16 +883,17 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
public ExcelWriter writeSecHeadRow(Iterable<?> rowData){ public ExcelWriter writeSecHeadRow(Iterable<?> rowData){
final Row row = RowUtil.getOrCreateRow(this.sheet,this.currentRow.getAndIncrement()); final Row row = RowUtil.getOrCreateRow(this.sheet,this.currentRow.getAndIncrement());
Iterator<?> iterator = rowData.iterator(); Iterator<?> iterator = rowData.iterator();
if (row.getLastCellNum() != 0){ if (row.getLastCellNum() != 0) {
for (int i = 0; i < this.workbook.getSpreadsheetVersion().getMaxColumns(); i++) { for (int i = 0; i < this.workbook.getSpreadsheetVersion().getMaxColumns(); i++) {
Cell cell = row.getCell(i); Cell cell = row.getCell(i);
if (cell == null) { if (cell != null) {
if(iterator.hasNext()){ continue;
cell = row.createCell(i); }
CellUtil.setCellValue(cell, iterator.next(), this.styleSet, true); if (iterator.hasNext()) {
}else{ cell = row.createCell(i);
break; CellUtil.setCellValue(cell, iterator.next(), this.styleSet, true);
} } else {
break;
} }
} }
} else { } else {