|
|
|
@@ -1,16 +1,16 @@
|
|
|
|
|
package excel.poi;
|
|
|
|
|
package com.lxyer.excel.poi;
|
|
|
|
|
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
|
import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
@@ -142,7 +142,7 @@ public class ExcelKit {
|
|
|
|
|
xlsName = new String(xlsName.getBytes("utf-8"),"iso-8859-1")+ ".xls";
|
|
|
|
|
}
|
|
|
|
|
OutputStream os = response.getOutputStream();
|
|
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
|
|
response.setContentType("application/vnd.ms-excel");
|
|
|
|
|
response.setHeader("Content-disposition", "attachment;filename="+xlsName);
|
|
|
|
|
|
|
|
|
|
wb.write(os);
|
|
|
|
@@ -331,10 +331,12 @@ public class ExcelKit {
|
|
|
|
|
private static boolean isEmptyRow(Row row, int len){
|
|
|
|
|
for (int i = 0; i< row.getLastCellNum() && i < len; i++) {
|
|
|
|
|
Cell cell = row.getCell(i);//列
|
|
|
|
|
if (cell != null && cell.getCellType() != 0
|
|
|
|
|
&& cell.getStringCellValue() != null
|
|
|
|
|
&& !cell.getStringCellValue().isEmpty()){
|
|
|
|
|
return false;
|
|
|
|
|
if (cell != null){
|
|
|
|
|
if (cell.getCellTypeEnum() != CellType.NUMERIC && cell.getStringCellValue() != null && !cell.getStringCellValue().isEmpty()){
|
|
|
|
|
return false;
|
|
|
|
|
}else if (cell.getCellTypeEnum() == CellType.NUMERIC && cell.getNumericCellValue() != 0){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|