|
@@ -19,6 +19,7 @@ import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFCell;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|
@@ -156,7 +157,10 @@ public class ExcelUtil {
|
|
|
}// end switch
|
|
|
colList.add(value);
|
|
|
}//end for j
|
|
|
- rowList.add(colList);
|
|
|
+ if(isAllNotEmpty(colList)) {
|
|
|
+
|
|
|
+ rowList.add(colList);
|
|
|
+ }
|
|
|
}//end for i
|
|
|
|
|
|
return rowList;
|
|
@@ -243,7 +247,10 @@ public class ExcelUtil {
|
|
|
|
|
|
colList.add(value);
|
|
|
}//end for j
|
|
|
- rowList.add(colList);
|
|
|
+ if(isAllNotEmpty(colList)) {
|
|
|
+
|
|
|
+ rowList.add(colList);
|
|
|
+ }
|
|
|
}//end for i
|
|
|
|
|
|
return rowList;
|
|
@@ -253,7 +260,16 @@ public class ExcelUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public static void writeExcel(ArrayList<ArrayList<Object>> result,String path){
|
|
|
+ private static boolean isAllNotEmpty(ArrayList<Object> colList) {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+ for (Object object : colList) {
|
|
|
+ String value = object.toString();
|
|
|
+ if(StringUtils.isNotBlank(value))
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ public static void writeExcel(ArrayList<ArrayList<Object>> result,String path){
|
|
|
if(result == null){
|
|
|
return;
|
|
|
}
|
|
@@ -368,7 +384,10 @@ public class ExcelUtil {
|
|
|
for (String data : datas) {
|
|
|
colList.add(data);
|
|
|
}
|
|
|
- rowList.add(colList);
|
|
|
+ if(isAllNotEmpty(colList)) {
|
|
|
+
|
|
|
+ rowList.add(colList);
|
|
|
+ }
|
|
|
}
|
|
|
}catch (Exception e) {
|
|
|
}finally{
|