Package de.muehlencord.shared.poi
Class PoiUtil
java.lang.Object
de.muehlencord.shared.poi.PoiUtil
- Author:
- Joern Muehlencord (joern@muehlencord.de)
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddCellComment(org.apache.poi.xssf.usermodel.XSSFWorkbook wb, org.apache.poi.ss.usermodel.Row row, int cellNumber, String cellComment) static voidaddCellComment(org.apache.poi.xssf.usermodel.XSSFWorkbook wb, org.apache.poi.ss.usermodel.Row row, int cellNumber, String cellComment, int rowCount, int columnCount) static voidaddCellComment(org.apache.poi.xssf.usermodel.XSSFWorkbook wb, org.apache.poi.ss.usermodel.Row row, int cellNumber, String cellComment, int rowCount, int columnCount, boolean commentVisible) static booleancellEmpty(org.apache.poi.ss.usermodel.Cell cell) static org.apache.poi.ss.usermodel.CellcreateOrGetCell(org.apache.poi.ss.usermodel.Row row, int cellNumber, org.apache.poi.ss.usermodel.CellStyle cellStyle) static booleangetBooleanValue(org.apache.poi.ss.usermodel.Row currentRow, int cellNumber, boolean returnDefaultValue, boolean defaultValue) static LocalDategetDateValue(org.apache.poi.ss.usermodel.Row row, int cellNumber) static LocalDategetDateValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, boolean returnDefaultValue, LocalDate defaultValue) static doublegetDoubleValue(org.apache.poi.ss.usermodel.Row currentRow, int cellNumber) static DoublegetDoubleValue(org.apache.poi.ss.usermodel.Row currentRow, int cellNumber, boolean returnDefaultValue, Double defaultValue) static intgetIntegerValue(org.apache.poi.ss.usermodel.Row currentRow, int cellNumber) static IntegergetIntegerValue(org.apache.poi.ss.usermodel.Row currentRow, int cellNumber, boolean returnDefaultValue, Integer defaultValue) static StringgetStringValue(org.apache.poi.ss.usermodel.Row row, int cellNumber) static StringgetStringValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, boolean mandatory) Returns the string value from the given cell.static StringgetStringValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, boolean returnDefaultValue, String defaultValue) protected static StringreplaceProblematicCharacters(String sourceValue) remove characters which often cause troubles in other applications - e.g.static voidsetBooleanValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, boolean value, org.apache.poi.ss.usermodel.CellStyle cellStyle) static voidsetDateValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, String dateString, String dateFormat, org.apache.poi.ss.usermodel.CellStyle cellStyle) static voidsetDateValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, Date date, org.apache.poi.ss.usermodel.CellStyle cellStyle) static voidsetDoubleValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, Double value, org.apache.poi.ss.usermodel.CellStyle cellStyle) static org.apache.poi.ss.usermodel.CellsetStringValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, String stringValue, org.apache.poi.ss.usermodel.CellStyle cellStyle)
-
Method Details
-
cellEmpty
public static boolean cellEmpty(org.apache.poi.ss.usermodel.Cell cell) -
createOrGetCell
public static org.apache.poi.ss.usermodel.Cell createOrGetCell(org.apache.poi.ss.usermodel.Row row, int cellNumber, org.apache.poi.ss.usermodel.CellStyle cellStyle) -
setStringValue
public static org.apache.poi.ss.usermodel.Cell setStringValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, String stringValue, org.apache.poi.ss.usermodel.CellStyle cellStyle) -
addCellComment
public static void addCellComment(org.apache.poi.xssf.usermodel.XSSFWorkbook wb, org.apache.poi.ss.usermodel.Row row, int cellNumber, String cellComment) -
addCellComment
public static void addCellComment(org.apache.poi.xssf.usermodel.XSSFWorkbook wb, org.apache.poi.ss.usermodel.Row row, int cellNumber, String cellComment, int rowCount, int columnCount) -
addCellComment
public static void addCellComment(org.apache.poi.xssf.usermodel.XSSFWorkbook wb, org.apache.poi.ss.usermodel.Row row, int cellNumber, String cellComment, int rowCount, int columnCount, boolean commentVisible) -
setDateValue
public static void setDateValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, Date date, org.apache.poi.ss.usermodel.CellStyle cellStyle) -
setDoubleValue
public static void setDoubleValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, Double value, org.apache.poi.ss.usermodel.CellStyle cellStyle) -
setBooleanValue
public static void setBooleanValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, boolean value, org.apache.poi.ss.usermodel.CellStyle cellStyle) -
setDateValue
-
getStringValue
public static String getStringValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, boolean mandatory) throws PoiException Returns the string value from the given cell. If the value is mandatory but the cell does not contain a value aPoiExceptionis thrown.- Parameters:
row- the row to read the value fromcellNumber- the cellnumber (starting with 0) of theRowto read the content from.mandatory- if set to true, aPoiExceptionis thrown, if the specified cell, does not contain any value. Otherwise null is returned if the cell is empty.- Returns:
- the String value of the specified cell.
- Throws:
PoiException- if the cell value cannot be read or if the cell is empty and mandatory has been set to true.
-
getStringValue
public static String getStringValue(org.apache.poi.ss.usermodel.Row row, int cellNumber) throws PoiException - Throws:
PoiException
-
getStringValue
public static String getStringValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, boolean returnDefaultValue, String defaultValue) throws PoiException - Throws:
PoiException
-
getDateValue
public static LocalDate getDateValue(org.apache.poi.ss.usermodel.Row row, int cellNumber) throws PoiException - Throws:
PoiException
-
getDateValue
public static LocalDate getDateValue(org.apache.poi.ss.usermodel.Row row, int cellNumber, boolean returnDefaultValue, LocalDate defaultValue) throws PoiException - Throws:
PoiException
-
getBooleanValue
public static boolean getBooleanValue(org.apache.poi.ss.usermodel.Row currentRow, int cellNumber, boolean returnDefaultValue, boolean defaultValue) throws PoiException - Throws:
PoiException
-
getDoubleValue
public static double getDoubleValue(org.apache.poi.ss.usermodel.Row currentRow, int cellNumber) throws PoiException - Throws:
PoiException
-
getDoubleValue
public static Double getDoubleValue(org.apache.poi.ss.usermodel.Row currentRow, int cellNumber, boolean returnDefaultValue, Double defaultValue) throws PoiException - Throws:
PoiException
-
getIntegerValue
public static int getIntegerValue(org.apache.poi.ss.usermodel.Row currentRow, int cellNumber) throws PoiException - Throws:
PoiException
-
getIntegerValue
public static Integer getIntegerValue(org.apache.poi.ss.usermodel.Row currentRow, int cellNumber, boolean returnDefaultValue, Integer defaultValue) throws PoiException - Throws:
PoiException
-
replaceProblematicCharacters
remove characters which often cause troubles in other applications - e.g. em dash (long dash) is created by Excel automatically- Parameters:
sourceValue- the input string to execute the replacement- Returns:
- sourceValue with replaced characters
-