Commit e5a05a84 authored by yanzg's avatar yanzg

合并空行BUG

parent 3540e3ae
...@@ -59,6 +59,10 @@ public class ExcelConsole<T extends Object> implements DbRow<T> { ...@@ -59,6 +59,10 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
* 行号 * 行号
*/ */
private int rowIndex; private int rowIndex;
/**
* 行数据
*/
private int rowData;
/** /**
* 合并列表組 * 合并列表組
...@@ -309,6 +313,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> { ...@@ -309,6 +313,7 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
} }
rowIndex++; rowIndex++;
rowData++;
if (this.rowIndex % 100 == 0) { if (this.rowIndex % 100 == 0) {
FileHelper.writeFile(new File(this.getFileNameRow()), StringHelper.toString(this.rowIndex), "utf-8"); FileHelper.writeFile(new File(this.getFileNameRow()), StringHelper.toString(this.rowIndex), "utf-8");
...@@ -363,18 +368,20 @@ public class ExcelConsole<T extends Object> implements DbRow<T> { ...@@ -363,18 +368,20 @@ public class ExcelConsole<T extends Object> implements DbRow<T> {
return this; return this;
} }
// 合并数据配置 // 合并数据配置
int columnPos = 0; if(this.rowData > 0){
for (ExportColumn column : this.config.getColumns()) { int columnPos = 0;
mergerColumn(column, columnPos, true); for (ExportColumn column : this.config.getColumns()) {
mergerColumn(column, columnPos, true);
if (column.getWidth() < 1) {
//设置单元格长度, 这里要乘上256 if (column.getWidth() < 1) {
int maxBytes = columnBytes.get(columnPos); //设置单元格长度, 这里要乘上256
sheet.setColumnWidth(columnPos, maxBytes * 256); int maxBytes = columnBytes.get(columnPos);
} else { sheet.setColumnWidth(columnPos, maxBytes * 256);
sheet.setColumnWidth(columnPos, getUnit(column.getWidth())); } else {
sheet.setColumnWidth(columnPos, getUnit(column.getWidth()));
}
columnPos++;
} }
columnPos++;
} }
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment