@@ -13,10 +13,11 @@ EasyPoi Excel和 Word简易工具类 | |||||
[测试项目](http://git.oschina.net/jueyue/easypoi-test): http://git.oschina.net/jueyue/easypoi-test | [测试项目](http://git.oschina.net/jueyue/easypoi-test): http://git.oschina.net/jueyue/easypoi-test | ||||
[开发文档请查看DOC下面的EasyPoi教程](http://git.oschina.net/jueyue/easypoi/blob/master/doc/EasyPoi%E6%95%99%E7%A8%8B.docx?dir=0&filepath=doc%2FEasyPoi%E6%95%99%E7%A8%8B.docx&oid=133ebde5641f128420023dbdc2533ab4b53c7792&sha=4c8d94c80544811e2e358518bad6c689a63c13e9) | |||||
!!!2.1.6 版本开始和之前的版本校验不兼用,使用JSR303的校验,删除了之前的注解,请注意 | !!!2.1.6 版本开始和之前的版本校验不兼用,使用JSR303的校验,删除了之前的注解,请注意 | ||||
!!! 2.3.0 模板导出有问题,请使用2.3.0.1修复版本 | !!! 2.3.0 模板导出有问题,请使用2.3.0.1修复版本 | ||||
开发文档请查看DOC下面的EasyPoi教程 | |||||
--------------------------- | --------------------------- | ||||
EasyPoi的主要特点 | EasyPoi的主要特点 | ||||
-------------------------- | -------------------------- | ||||
@@ -94,6 +94,11 @@ public class ExportParams extends ExcelBaseParams { | |||||
* 是否追加图形 | * 是否追加图形 | ||||
*/ | */ | ||||
private boolean isAppendGraph = true; | private boolean isAppendGraph = true; | ||||
/** | |||||
* 单sheet最大值 | |||||
* 03版本默认6W行,07默认100W | |||||
*/ | |||||
private int maxNum = 0; | |||||
public ExportParams() { | public ExportParams() { | ||||
@@ -244,4 +249,12 @@ public class ExportParams extends ExcelBaseParams { | |||||
this.isAppendGraph = isAppendGraph; | this.isAppendGraph = isAppendGraph; | ||||
} | } | ||||
public int getMaxNum() { | |||||
return maxNum; | |||||
} | |||||
public void setMaxNum(int maxNum) { | |||||
this.maxNum = maxNum; | |||||
} | |||||
} | } |
@@ -143,6 +143,9 @@ public class ExcelExportServer extends ExcelExportBase { | |||||
if (type.equals(ExcelType.XSSF)) { | if (type.equals(ExcelType.XSSF)) { | ||||
MAX_NUM = 1000000; | MAX_NUM = 1000000; | ||||
} | } | ||||
if( entity.getMaxNum() >0) { | |||||
MAX_NUM = entity.getMaxNum(); | |||||
} | |||||
Sheet sheet = null; | Sheet sheet = null; | ||||
try { | try { | ||||
sheet = workbook.createSheet(entity.getSheetName()); | sheet = workbook.createSheet(entity.getSheetName()); | ||||
@@ -245,6 +245,7 @@ public final class ExcelExportOfTemplateUtil extends ExcelExportBase { | |||||
private void parseTemplate(Sheet sheet, Map<String, Object> map, boolean colForeach) throws Exception { | private void parseTemplate(Sheet sheet, Map<String, Object> map, boolean colForeach) throws Exception { | ||||
deleteCell(sheet, map); | deleteCell(sheet, map); | ||||
mergedRegionHelper = new MergedRegionHelper(sheet); | |||||
if(colForeach){ | if(colForeach){ | ||||
colForeach(sheet, map); | colForeach(sheet, map); | ||||
} | } | ||||
@@ -273,7 +274,6 @@ public final class ExcelExportOfTemplateUtil extends ExcelExportBase { | |||||
Row row = null; | Row row = null; | ||||
Cell cell = null; | Cell cell = null; | ||||
int index = 0; | int index = 0; | ||||
mergedRegionHelper = new MergedRegionHelper(sheet); | |||||
while (index <= sheet.getLastRowNum()) { | while (index <= sheet.getLastRowNum()) { | ||||
row = sheet.getRow(index++); | row = sheet.getRow(index++); | ||||
if (row == null) { | if (row == null) { | ||||
@@ -445,8 +445,10 @@ public final class ExcelExportOfTemplateUtil extends ExcelExportBase { | |||||
rowIndex += rowspan - 1; | rowIndex += rowspan - 1; | ||||
} | } | ||||
if (isShift && datas.size() * rowspan > 1) { | if (isShift && datas.size() * rowspan > 1) { | ||||
cell.getRow().getSheet().shiftRows(cell.getRowIndex() + 1, | |||||
cell.getRow().getSheet().getLastRowNum(), datas.size() * rowspan - 1, true, true); | |||||
cell.getRow().getSheet().shiftRows(cell.getRowIndex() + rowspan, | |||||
cell.getRow().getSheet().getLastRowNum(), (datas.size() - 1) * rowspan , true, true); | |||||
/* cell.getRow().getSheet().shiftRows(cell.getRowIndex() + 1, | |||||
cell.getRow().getSheet().getLastRowNum(), datas.size() * rowspan - 1, true, true);*/ | |||||
} | } | ||||
while (its.hasNext()) { | while (its.hasNext()) { | ||||
Object t = its.next(); | Object t = its.next(); | ||||