updated libraries
This commit is contained in:
@ -255,8 +255,28 @@ public abstract class PoiUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static int getIntegerValue(Row currentRow, int cellNumber) throws PoiException {
|
||||
return getIntegerValue(currentRow, cellNumber, false, 0);
|
||||
}
|
||||
|
||||
public static Integer getIntegerValue(Row currentRow, int cellNumber, boolean returnDefaultValue, Integer defaultValue) throws PoiException {
|
||||
if (currentRow == null) {
|
||||
throw new PoiException("Current row must not be null");
|
||||
}
|
||||
Cell cell = currentRow.getCell(cellNumber);
|
||||
if ((PoiUtil.cellEmpty(cell)) && !returnDefaultValue) {
|
||||
throw new PoiException("Cannot read cell " + cellNumber + " from row " + currentRow.getRowNum());
|
||||
} else {
|
||||
if (PoiUtil.cellEmpty(cell)) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
return Double.valueOf(cell.getNumericCellValue()).intValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* remove charecters which often cause troubles in other applications - e.g. em dash (long dash) is created by Excel automatically
|
||||
* remove characters which often cause troubles in other applications - e.g. em dash (long dash) is created by Excel automatically
|
||||
*
|
||||
* @param sourceValue the input string to execute the replacement
|
||||
* @return sourceValue with replaced characters
|
||||
|
||||
Reference in New Issue
Block a user