|
|
|
|
@ -12,6 +12,13 @@ import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
|
import org.apache.poi.ss.usermodel.DateUtil;
|
|
|
|
|
|
|
|
|
|
public class XLSReader extends XLS {
|
|
|
|
|
private boolean numAsDate;
|
|
|
|
|
|
|
|
|
|
public XLSReader setNumberAsDate(boolean asDate) {
|
|
|
|
|
numAsDate = asDate;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public XLSReader open(InputStream input) {
|
|
|
|
|
load(input);
|
|
|
|
|
return this;
|
|
|
|
|
@ -54,7 +61,7 @@ public class XLSReader extends XLS {
|
|
|
|
|
public String value(Cell cell) {
|
|
|
|
|
return switch (cell.getCellType()) {
|
|
|
|
|
case STRING -> cell.getStringCellValue();
|
|
|
|
|
case NUMERIC -> DateUtil.isCellDateFormatted(cell) ?
|
|
|
|
|
case NUMERIC -> numAsDate && DateUtil.isCellDateFormatted(cell) ?
|
|
|
|
|
cell.getDateCellValue().toString() :
|
|
|
|
|
String.valueOf(cell.getNumericCellValue());
|
|
|
|
|
case BOOLEAN -> String.valueOf(cell.getBooleanCellValue());
|
|
|
|
|
|