|
@@ -12,9 +12,11 @@ import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.HashMap;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.text.DateFormat;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
public class ExcelUtils {
|
|
|
|
|
@@ -162,4 +164,20 @@ public class ExcelUtils {
|
|
|
cellStyle.setBorderRight(BorderStyle.THIN);
|
|
|
cellStyle.setBorderTop(BorderStyle.THIN);
|
|
|
}
|
|
|
+ public static String getValue(Cell cell) {
|
|
|
+ if (cell != null) {
|
|
|
+ if (cell.getCellType() == CellType.NUMERIC && HSSFDateUtil.isCellDateFormatted(cell)) {
|
|
|
+ Date date = cell.getDateCellValue();
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String dateString = dateFormat.format(date);
|
|
|
+ return dateString;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ return cell.toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|