Skip to content

Commit

Permalink
replaced obsolete CellType enum
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelendik committed Jun 10, 2020
1 parent 8f605eb commit 1f6d45e
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@
import java.util.Locale;

import org.apache.log4j.Logger;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.model.ExternalLinksTable;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFTable;
Expand Down Expand Up @@ -146,15 +151,15 @@ public static String getCellValue(Cell cell) {
return "";

switch (cell.getCellType()) {
case Cell.CELL_TYPE_STRING:
case STRING:
return df.formatCellValue(cell).trim();
case Cell.CELL_TYPE_NUMERIC:
case NUMERIC:
return df.formatCellValue(cell).trim();
case Cell.CELL_TYPE_BOOLEAN:
case BOOLEAN:
return df.formatCellValue(cell).trim();
case Cell.CELL_TYPE_FORMULA:
case FORMULA:
return (cell.getCellFormula().contains("[") && cell.getCellFormula().contains("]")) ? null : df.formatCellValue(cell, evaluator).trim();
case Cell.CELL_TYPE_BLANK:
case BLANK:
return "";
default:
return null;
Expand All @@ -165,7 +170,7 @@ public static XLSChildTable parseCellLinks(Cell cell, Workbook wb, Sheet sheet)
if (cell == null)
return null;

if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
if (cell.getCellType() == CellType.FORMULA) {
if (cell.getCellFormula().contains("#This Row")) {
if (cell.getCellFormula().contains("!")) {
// Parse link to the cell with table name in the external doc([2]!Table1[[#This Row],[Header6]])
Expand Down

0 comments on commit 1f6d45e

Please sign in to comment.