use non-deprecated versions of getCellType

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808741 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2017-09-18 16:31:55 +00:00
parent e0ee55e75f
commit 51305b6260
34 changed files with 96 additions and 96 deletions

View File

@ -144,7 +144,7 @@ public class SVSheetTable extends JTable {
HSSFCell cell = (HSSFCell) getValueAt(row, col);
String formula = "";
if (cell != null) {
if (cell.getCellTypeEnum() == CellType.FORMULA) {
if (cell.getCellType() == CellType.FORMULA) {
formula = cell.getCellFormula();
} else {
formula = cell.toString();

View File

@ -166,7 +166,7 @@ public class SVTableCellEditor extends AbstractCellEditor implements TableCellEd
//Set the value that is rendered for the cell
switch (cell.getCellTypeEnum()) {
switch (cell.getCellType()) {
case BLANK:
editor.setText("");
break;

View File

@ -168,7 +168,7 @@ public class SVTableCellRenderer extends JLabel
isBorderSet=true;
//Set the value that is rendered for the cell
switch (c.getCellTypeEnum()) {
switch (c.getCellType()) {
case BLANK:
setValue("");
break;

View File

@ -544,7 +544,7 @@ public class ToCSV {
csvLine.add("");
}
else {
if(cell.getCellTypeEnum() != CellType.FORMULA) {
if(cell.getCellType() != CellType.FORMULA) {
csvLine.add(this.formatter.formatCellValue(cell));
}
else {

View File

@ -102,7 +102,7 @@ public class HSSFHyperlink implements Hyperlink {
link_type = getType(record);
}
else {
link_type = other.getTypeEnum();
link_type = other.getType();
record = new HyperlinkRecord();
setFirstRow(other.getFirstRow());
setFirstColumn(other.getFirstColumn());

View File

@ -62,7 +62,7 @@ final class SheetRefEvaluator {
public boolean isSubTotal(int rowIndex, int columnIndex){
boolean subtotal = false;
EvaluationCell cell = getSheet().getCell(rowIndex, columnIndex);
if(cell != null && cell.getCellTypeEnum() == CellType.FORMULA){
if(cell != null && cell.getCellType() == CellType.FORMULA){
EvaluationWorkbook wb = _bookEvaluator.getWorkbook();
for(Ptg ptg : wb.getFormulaTokens(cell)){
if(ptg instanceof FuncVarPtg){

View File

@ -978,7 +978,7 @@ public class DataFormatter implements Observer {
return "";
}
CellType cellType = cell.getCellTypeEnum();
CellType cellType = cell.getCellType();
if (cellType == CellType.FORMULA) {
if (evaluator == null) {
return cell.getCellFormula();

View File

@ -42,7 +42,7 @@ public class DataSources {
return new AbstractCellRangeDataSource<Number>(sheet, cellRangeAddress) {
public Number getPointAt(int index) {
CellValue cellValue = getCellValueAt(index);
if (cellValue != null && cellValue.getCellTypeEnum() == CellType.NUMERIC) {
if (cellValue != null && cellValue.getCellType() == CellType.NUMERIC) {
return Double.valueOf(cellValue.getNumberValue());
} else {
return null;
@ -59,7 +59,7 @@ public class DataSources {
return new AbstractCellRangeDataSource<String>(sheet, cellRangeAddress) {
public String getPointAt(int index) {
CellValue cellValue = getCellValueAt(index);
if (cellValue != null && cellValue.getCellTypeEnum() == CellType.STRING) {
if (cellValue != null && cellValue.getCellType() == CellType.STRING) {
return cellValue.getStringValue();
} else {
return null;

View File

@ -392,7 +392,7 @@ public class SXSSFCell implements Cell {
* For strings we throw an exception. For blank cells we return a null.
* </p>
* @return the value of the cell as a date
* @throws IllegalStateException if the cell type returned by {@link #getCellTypeEnum()} is CellType.STRING
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} is CellType.STRING
* @exception NumberFormatException if the cell value isn't a parsable <code>double</code>.
* @see org.apache.poi.ss.usermodel.DataFormatter for formatting this date into a string similar to how excel does.
*/
@ -512,7 +512,7 @@ public class SXSSFCell implements Cell {
* For strings, numbers, and errors, we throw an exception. For blank cells we return a false.
* </p>
* @return the value of the cell as a boolean
* @throws IllegalStateException if the cell type returned by {@link #getCellTypeEnum()}
* @throws IllegalStateException if the cell type returned by {@link #getCellType()}
* is not CellType.BOOLEAN, CellType.BLANK or CellType.FORMULA
*/
@Override
@ -547,7 +547,7 @@ public class SXSSFCell implements Cell {
* </p>
*
* @return the value of the cell as an error code
* @throws IllegalStateException if the cell type returned by {@link #getCellTypeEnum()} isn't CellType.ERROR
* @throws IllegalStateException if the cell type returned by {@link #getCellType()} isn't CellType.ERROR
* @see org.apache.poi.ss.usermodel.FormulaError for error codes
*/
@Override
@ -727,7 +727,7 @@ public class SXSSFCell implements Cell {
*/
@Override
public String toString() {
switch (getCellTypeEnum()) {
switch (getCellType()) {
case BLANK:
return "";
case BOOLEAN:

View File

@ -256,7 +256,7 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow>
case RETURN_NULL_AND_BLANK:
return cell;
case RETURN_BLANK_AS_NULL:
boolean isBlank = (cell != null && cell.getCellTypeEnum() == CellType.BLANK);
boolean isBlank = (cell != null && cell.getCellType() == CellType.BLANK);
return (isBlank) ? null : cell;
case CREATE_NULL_AS_BLANK:
return (cell == null) ? createCell(cellnum, CellType.BLANK) : cell;

View File

@ -75,7 +75,7 @@ public final class XSSFFormulaUtils {
for (Sheet sh : _wb) {
for (Row row : sh) {
for (Cell cell : row) {
if (cell.getCellTypeEnum() == CellType.FORMULA) {
if (cell.getCellType() == CellType.FORMULA) {
updateFormula((XSSFCell) cell, oldName, newName);
}
}

View File

@ -275,7 +275,7 @@ public abstract class BaseTestXSSFPivotTable {
@Test
public void testAddDataColumnWithOffsetData() {
offsetPivotTable.addColumnLabel(DataConsolidateFunction.SUM, 1);
assertEquals(CellType.NUMERIC, offsetOuterCell.getCellTypeEnum());
assertEquals(CellType.NUMERIC, offsetOuterCell.getCellType());
offsetPivotTable.addColumnLabel(DataConsolidateFunction.SUM, 0);
}

View File

@ -486,7 +486,7 @@ public final class TestXSSFFormulaParser {
for (Row row : xsheet) {
for (Cell cell : row) {
if (cell.getCellTypeEnum() == CellType.FORMULA) {
if (cell.getCellType() == CellType.FORMULA) {
try {
evaluator.evaluateFormulaCell(cell);
} catch (Exception e) {

View File

@ -158,7 +158,7 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
doTestHyperlinkContents(sheet);
assertEquals(HyperlinkType.URL,
sheet.getRow(17).getCell(2).getHyperlink().getTypeEnum());
sheet.getRow(17).getCell(2).getHyperlink().getType());
assertEquals("POI SS Link",
sheet.getRow(17).getCell(2).getHyperlink().getLabel());
assertEquals("http://poi.apache.org/spreadsheet/",
@ -179,7 +179,7 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
doTestHyperlinkContents(sheet);
assertEquals(HyperlinkType.URL,
sheet.getRow(17).getCell(2).getHyperlink().getTypeEnum());
sheet.getRow(17).getCell(2).getHyperlink().getType());
assertEquals("POI SS Link",
sheet.getRow(17).getCell(2).getHyperlink().getLabel());
assertEquals("http://poi.apache.org/spreadsheet/",
@ -197,7 +197,7 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
// First is a link to poi
assertEquals(HyperlinkType.URL,
sheet.getRow(3).getCell(2).getHyperlink().getTypeEnum());
sheet.getRow(3).getCell(2).getHyperlink().getType());
assertEquals(null,
sheet.getRow(3).getCell(2).getHyperlink().getLabel());
assertEquals("http://poi.apache.org/",
@ -205,7 +205,7 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
// Next is an internal doc link
assertEquals(HyperlinkType.DOCUMENT,
sheet.getRow(14).getCell(2).getHyperlink().getTypeEnum());
sheet.getRow(14).getCell(2).getHyperlink().getType());
assertEquals("Internal hyperlink to A2",
sheet.getRow(14).getCell(2).getHyperlink().getLabel());
assertEquals("Sheet1!A2",
@ -213,7 +213,7 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
// Next is a file
assertEquals(HyperlinkType.FILE,
sheet.getRow(15).getCell(2).getHyperlink().getTypeEnum());
sheet.getRow(15).getCell(2).getHyperlink().getType());
assertEquals(null,
sheet.getRow(15).getCell(2).getHyperlink().getLabel());
assertEquals("WithVariousData.xlsx",
@ -221,7 +221,7 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
// Last is a mailto
assertEquals(HyperlinkType.EMAIL,
sheet.getRow(16).getCell(2).getHyperlink().getTypeEnum());
sheet.getRow(16).getCell(2).getHyperlink().getType());
assertEquals(null,
sheet.getRow(16).getCell(2).getHyperlink().getLabel());
assertEquals("mailto:dev@poi.apache.org?subject=XSSF%20Hyperlinks",
@ -238,13 +238,13 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
assertEquals(sh1.getNumberOfComments(), sh2.getNumberOfComments());
XSSFHyperlink l1 = sh1.getHyperlink(0, 1);
assertEquals(HyperlinkType.DOCUMENT, l1.getTypeEnum());
assertEquals(HyperlinkType.DOCUMENT, l1.getType());
assertEquals("B1", l1.getCellRef());
assertEquals("Sort on Titel", l1.getTooltip());
XSSFHyperlink l2 = sh2.getHyperlink(0, 1);
assertEquals(l1.getTooltip(), l2.getTooltip());
assertEquals(HyperlinkType.DOCUMENT, l2.getTypeEnum());
assertEquals(HyperlinkType.DOCUMENT, l2.getType());
assertEquals("B1", l2.getCellRef());
}
@ -309,22 +309,22 @@ public final class TestXSSFHyperlink extends BaseTestHyperlink {
XSSFHyperlink link = sh.getHyperlink(A2);
assertEquals("address", "A2", link.getCellRef());
assertEquals("link type", HyperlinkType.URL, link.getTypeEnum());
assertEquals("link type", HyperlinkType.URL, link.getType());
assertEquals("link target", "http://twitter.com/#!/apacheorg", link.getAddress());
link = sh.getHyperlink(A3);
assertEquals("address", "A3", link.getCellRef());
assertEquals("link type", HyperlinkType.URL, link.getTypeEnum());
assertEquals("link type", HyperlinkType.URL, link.getType());
assertEquals("link target", "http://www.bailii.org/databases.html#ie", link.getAddress());
link = sh.getHyperlink(A4);
assertEquals("address", "A4", link.getCellRef());
assertEquals("link type", HyperlinkType.URL, link.getTypeEnum());
assertEquals("link type", HyperlinkType.URL, link.getType());
assertEquals("link target", "https://en.wikipedia.org/wiki/Apache_POI#See_also", link.getAddress());
link = sh.getHyperlink(A7);
assertEquals("address", "A7", link.getCellRef());
assertEquals("link type", HyperlinkType.DOCUMENT, link.getTypeEnum());
assertEquals("link type", HyperlinkType.DOCUMENT, link.getType());
assertEquals("link target", "Sheet1", link.getAddress());
wb.close();

View File

@ -1470,44 +1470,44 @@ public final class TestXSSFSheet extends BaseTestXSheet {
// Blank
cell = CellUtil.getCell(destRow, col++);
assertEquals("[Blank] C7 cell type", CellType.BLANK, cell.getCellTypeEnum());
assertEquals("[Blank] C7 cell type", CellType.BLANK, cell.getCellType());
// Error
cell = CellUtil.getCell(destRow, col++);
assertEquals("[Error] D7 cell type", CellType.ERROR, cell.getCellTypeEnum());
assertEquals("[Error] D7 cell type", CellType.ERROR, cell.getCellType());
final FormulaError error = FormulaError.forInt(cell.getErrorCellValue());
assertEquals("[Error] D7 cell value", FormulaError.NA, error); //FIXME: XSSFCell and HSSFCell expose different interfaces. getErrorCellString would be helpful here
// Date
cell = CellUtil.getCell(destRow, col++);
assertEquals("[Date] E7 cell type", CellType.NUMERIC, cell.getCellTypeEnum());
assertEquals("[Date] E7 cell type", CellType.NUMERIC, cell.getCellType());
final Date date = LocaleUtil.getLocaleCalendar(2000, Calendar.JANUARY, 1).getTime();
assertEquals("[Date] E7 cell value", date, cell.getDateCellValue());
// Boolean
cell = CellUtil.getCell(destRow, col++);
assertEquals("[Boolean] F7 cell type", CellType.BOOLEAN, cell.getCellTypeEnum());
assertEquals("[Boolean] F7 cell type", CellType.BOOLEAN, cell.getCellType());
assertEquals("[Boolean] F7 cell value", true, cell.getBooleanCellValue());
// String
cell = CellUtil.getCell(destRow, col++);
assertEquals("[String] G7 cell type", CellType.STRING, cell.getCellTypeEnum());
assertEquals("[String] G7 cell type", CellType.STRING, cell.getCellType());
assertEquals("[String] G7 cell value", "Hello", cell.getStringCellValue());
// Int
cell = CellUtil.getCell(destRow, col++);
assertEquals("[Int] H7 cell type", CellType.NUMERIC, cell.getCellTypeEnum());
assertEquals("[Int] H7 cell type", CellType.NUMERIC, cell.getCellType());
assertEquals("[Int] H7 cell value", 15, (int) cell.getNumericCellValue());
// Float
cell = CellUtil.getCell(destRow, col++);
assertEquals("[Float] I7 cell type", CellType.NUMERIC, cell.getCellTypeEnum());
assertEquals("[Float] I7 cell type", CellType.NUMERIC, cell.getCellType());
assertEquals("[Float] I7 cell value", 12.5, cell.getNumericCellValue(), FLOAT_PRECISION);
// Cell Formula
cell = CellUtil.getCell(destRow, col++);
assertEquals("J7", new CellReference(cell).formatAsString());
assertEquals("[Cell Formula] J7 cell type", CellType.FORMULA, cell.getCellTypeEnum());
assertEquals("[Cell Formula] J7 cell type", CellType.FORMULA, cell.getCellType());
assertEquals("[Cell Formula] J7 cell formula", "5+2", cell.getCellFormula());
System.out.println("Cell formula evaluation currently unsupported");
@ -1516,21 +1516,21 @@ public final class TestXSSFSheet extends BaseTestXSheet {
cell = CellUtil.getCell(destRow, col++);
assertEquals("K7", new CellReference(cell).formatAsString());
assertEquals("[Cell Formula with Reference] K7 cell type",
CellType.FORMULA, cell.getCellTypeEnum());
CellType.FORMULA, cell.getCellType());
assertEquals("[Cell Formula with Reference] K7 cell formula",
"J7+H$2", cell.getCellFormula());
// Cell Formula with Reference spanning multiple rows
cell = CellUtil.getCell(destRow, col++);
assertEquals("[Cell Formula with Reference spanning multiple rows] L7 cell type",
CellType.FORMULA, cell.getCellTypeEnum());
CellType.FORMULA, cell.getCellType());
assertEquals("[Cell Formula with Reference spanning multiple rows] L7 cell formula",
"G7&\" \"&G8", cell.getCellFormula());
// Cell Formula with Reference spanning multiple rows
cell = CellUtil.getCell(destRow, col++);
assertEquals("[Cell Formula with Area Reference] M7 cell type",
CellType.FORMULA, cell.getCellTypeEnum());
CellType.FORMULA, cell.getCellType());
assertEquals("[Cell Formula with Area Reference] M7 cell formula",
"SUM(H7:I8)", cell.getCellFormula());
@ -1539,13 +1539,13 @@ public final class TestXSSFSheet extends BaseTestXSheet {
System.out.println("Array formulas currently unsupported");
// FIXME: Array Formula set with Sheet.setArrayFormula() instead of cell.setFormula()
/*
assertEquals("[Array Formula] N7 cell type", CellType.FORMULA, cell.getCellTypeEnum());
assertEquals("[Array Formula] N7 cell type", CellType.FORMULA, cell.getCellType());
assertEquals("[Array Formula] N7 cell formula", "{SUM(H7:J7*{1,2,3})}", cell.getCellFormula());
*/
// Data Format
cell = CellUtil.getCell(destRow, col++);
assertEquals("[Data Format] O7 cell type;", CellType.NUMERIC, cell.getCellTypeEnum());
assertEquals("[Data Format] O7 cell type;", CellType.NUMERIC, cell.getCellType());
assertEquals("[Data Format] O7 cell value", 100.20, cell.getNumericCellValue(), FLOAT_PRECISION);
//FIXME: currently fails
final String moneyFormat = "\"$\"#,##0.00_);[Red]\\(\"$\"#,##0.00\\)";
@ -1624,83 +1624,83 @@ public final class TestXSSFSheet extends BaseTestXSheet {
// Blank
col++;
cell = CellUtil.getCell(destRow1, col);
assertEquals("[Blank] C10 cell type", CellType.BLANK, cell.getCellTypeEnum());
assertEquals("[Blank] C10 cell type", CellType.BLANK, cell.getCellType());
cell = CellUtil.getCell(destRow2, col);
assertEquals("[Blank] C11 cell type", CellType.BLANK, cell.getCellTypeEnum());
assertEquals("[Blank] C11 cell type", CellType.BLANK, cell.getCellType());
// Error
col++;
cell = CellUtil.getCell(destRow1, col);
assertEquals("[Error] D10 cell type", CellType.ERROR, cell.getCellTypeEnum());
assertEquals("[Error] D10 cell type", CellType.ERROR, cell.getCellType());
FormulaError error = FormulaError.forInt(cell.getErrorCellValue());
assertEquals("[Error] D10 cell value", FormulaError.NA, error); //FIXME: XSSFCell and HSSFCell expose different interfaces. getErrorCellString would be helpful here
cell = CellUtil.getCell(destRow2, col);
assertEquals("[Error] D11 cell type", CellType.ERROR, cell.getCellTypeEnum());
assertEquals("[Error] D11 cell type", CellType.ERROR, cell.getCellType());
error = FormulaError.forInt(cell.getErrorCellValue());
assertEquals("[Error] D11 cell value", FormulaError.NAME, error); //FIXME: XSSFCell and HSSFCell expose different interfaces. getErrorCellString would be helpful here
// Date
col++;
cell = CellUtil.getCell(destRow1, col);
assertEquals("[Date] E10 cell type", CellType.NUMERIC, cell.getCellTypeEnum());
assertEquals("[Date] E10 cell type", CellType.NUMERIC, cell.getCellType());
Date date = LocaleUtil.getLocaleCalendar(2000, Calendar.JANUARY, 1).getTime();
assertEquals("[Date] E10 cell value", date, cell.getDateCellValue());
cell = CellUtil.getCell(destRow2, col);
assertEquals("[Date] E11 cell type", CellType.NUMERIC, cell.getCellTypeEnum());
assertEquals("[Date] E11 cell type", CellType.NUMERIC, cell.getCellType());
date = LocaleUtil.getLocaleCalendar(2000, Calendar.JANUARY, 2).getTime();
assertEquals("[Date] E11 cell value", date, cell.getDateCellValue());
// Boolean
col++;
cell = CellUtil.getCell(destRow1, col);
assertEquals("[Boolean] F10 cell type", CellType.BOOLEAN, cell.getCellTypeEnum());
assertEquals("[Boolean] F10 cell type", CellType.BOOLEAN, cell.getCellType());
assertEquals("[Boolean] F10 cell value", true, cell.getBooleanCellValue());
cell = CellUtil.getCell(destRow2, col);
assertEquals("[Boolean] F11 cell type", CellType.BOOLEAN, cell.getCellTypeEnum());
assertEquals("[Boolean] F11 cell type", CellType.BOOLEAN, cell.getCellType());
assertEquals("[Boolean] F11 cell value", false, cell.getBooleanCellValue());
// String
col++;
cell = CellUtil.getCell(destRow1, col);
assertEquals("[String] G10 cell type", CellType.STRING, cell.getCellTypeEnum());
assertEquals("[String] G10 cell type", CellType.STRING, cell.getCellType());
assertEquals("[String] G10 cell value", "Hello", cell.getStringCellValue());
cell = CellUtil.getCell(destRow2, col);
assertEquals("[String] G11 cell type", CellType.STRING, cell.getCellTypeEnum());
assertEquals("[String] G11 cell type", CellType.STRING, cell.getCellType());
assertEquals("[String] G11 cell value", "World", cell.getStringCellValue());
// Int
col++;
cell = CellUtil.getCell(destRow1, col);
assertEquals("[Int] H10 cell type", CellType.NUMERIC, cell.getCellTypeEnum());
assertEquals("[Int] H10 cell type", CellType.NUMERIC, cell.getCellType());
assertEquals("[Int] H10 cell value", 15, (int) cell.getNumericCellValue());
cell = CellUtil.getCell(destRow2, col);
assertEquals("[Int] H11 cell type", CellType.NUMERIC, cell.getCellTypeEnum());
assertEquals("[Int] H11 cell type", CellType.NUMERIC, cell.getCellType());
assertEquals("[Int] H11 cell value", 42, (int) cell.getNumericCellValue());
// Float
col++;
cell = CellUtil.getCell(destRow1, col);
assertEquals("[Float] I10 cell type", CellType.NUMERIC, cell.getCellTypeEnum());
assertEquals("[Float] I10 cell type", CellType.NUMERIC, cell.getCellType());
assertEquals("[Float] I10 cell value", 12.5, cell.getNumericCellValue(), FLOAT_PRECISION);
cell = CellUtil.getCell(destRow2, col);
assertEquals("[Float] I11 cell type", CellType.NUMERIC, cell.getCellTypeEnum());
assertEquals("[Float] I11 cell type", CellType.NUMERIC, cell.getCellType());
assertEquals("[Float] I11 cell value", 5.5, cell.getNumericCellValue(), FLOAT_PRECISION);
// Cell Formula
col++;
cell = CellUtil.getCell(destRow1, col);
assertEquals("[Cell Formula] J10 cell type", CellType.FORMULA, cell.getCellTypeEnum());
assertEquals("[Cell Formula] J10 cell type", CellType.FORMULA, cell.getCellType());
assertEquals("[Cell Formula] J10 cell formula", "5+2", cell.getCellFormula());
cell = CellUtil.getCell(destRow2, col);
assertEquals("[Cell Formula] J11 cell type", CellType.FORMULA, cell.getCellTypeEnum());
assertEquals("[Cell Formula] J11 cell type", CellType.FORMULA, cell.getCellType());
assertEquals("[Cell Formula] J11 cell formula", "6+18", cell.getCellFormula());
// Cell Formula with Reference
@ -1708,25 +1708,25 @@ public final class TestXSSFSheet extends BaseTestXSheet {
// Formula row references should be adjusted by destRowNum-srcRowNum
cell = CellUtil.getCell(destRow1, col);
assertEquals("[Cell Formula with Reference] K10 cell type",
CellType.FORMULA, cell.getCellTypeEnum());
CellType.FORMULA, cell.getCellType());
assertEquals("[Cell Formula with Reference] K10 cell formula",
"J10+H$2", cell.getCellFormula());
cell = CellUtil.getCell(destRow2, col);
assertEquals("[Cell Formula with Reference] K11 cell type", CellType.FORMULA, cell.getCellTypeEnum());
assertEquals("[Cell Formula with Reference] K11 cell type", CellType.FORMULA, cell.getCellType());
assertEquals("[Cell Formula with Reference] K11 cell formula", "J11+H$2", cell.getCellFormula());
// Cell Formula with Reference spanning multiple rows
col++;
cell = CellUtil.getCell(destRow1, col);
assertEquals("[Cell Formula with Reference spanning multiple rows] L10 cell type",
CellType.FORMULA, cell.getCellTypeEnum());
CellType.FORMULA, cell.getCellType());
assertEquals("[Cell Formula with Reference spanning multiple rows] L10 cell formula",
"G10&\" \"&G11", cell.getCellFormula());
cell = CellUtil.getCell(destRow2, col);
assertEquals("[Cell Formula with Reference spanning multiple rows] L11 cell type",
CellType.FORMULA, cell.getCellTypeEnum());
CellType.FORMULA, cell.getCellType());
assertEquals("[Cell Formula with Reference spanning multiple rows] L11 cell formula",
"G11&\" \"&G12", cell.getCellFormula());
@ -1734,13 +1734,13 @@ public final class TestXSSFSheet extends BaseTestXSheet {
col++;
cell = CellUtil.getCell(destRow1, col);
assertEquals("[Cell Formula with Area Reference] M10 cell type",
CellType.FORMULA, cell.getCellTypeEnum());
CellType.FORMULA, cell.getCellType());
assertEquals("[Cell Formula with Area Reference] M10 cell formula",
"SUM(H10:I11)", cell.getCellFormula());
cell = CellUtil.getCell(destRow2, col);
assertEquals("[Cell Formula with Area Reference] M11 cell type",
CellType.FORMULA, cell.getCellTypeEnum());
CellType.FORMULA, cell.getCellType());
assertEquals("[Cell Formula with Area Reference] M11 cell formula",
"SUM($H$3:I10)", cell.getCellFormula()); //Also acceptable: SUM($H10:I$3), but this AreaReference isn't in ascending order
@ -1750,19 +1750,19 @@ public final class TestXSSFSheet extends BaseTestXSheet {
// System.out.println("Array formulas currently unsupported");
/*
// FIXME: Array Formula set with Sheet.setArrayFormula() instead of cell.setFormula()
assertEquals("[Array Formula] N10 cell type", CellType.FORMULA, cell.getCellTypeEnum());
assertEquals("[Array Formula] N10 cell type", CellType.FORMULA, cell.getCellType());
assertEquals("[Array Formula] N10 cell formula", "{SUM(H10:J10*{1,2,3})}", cell.getCellFormula());
cell = CellUtil.getCell(destRow2, col);
// FIXME: Array Formula set with Sheet.setArrayFormula() instead of cell.setFormula()
assertEquals("[Array Formula] N11 cell type", CellType.FORMULA, cell.getCellTypeEnum());
assertEquals("[Array Formula] N11 cell type", CellType.FORMULA, cell.getCellType());
assertEquals("[Array Formula] N11 cell formula", "{SUM(H11:J11*{1,2,3})}", cell.getCellFormula());
*/
// Data Format
col++;
cell = CellUtil.getCell(destRow2, col);
assertEquals("[Data Format] O10 cell type", CellType.NUMERIC, cell.getCellTypeEnum());
assertEquals("[Data Format] O10 cell type", CellType.NUMERIC, cell.getCellType());
assertEquals("[Data Format] O10 cell value", 100.20, cell.getNumericCellValue(), FLOAT_PRECISION);
final String moneyFormat = "\"$\"#,##0.00_);[Red]\\(\"$\"#,##0.00\\)";
assertEquals("[Data Format] O10 cell data format", moneyFormat, cell.getCellStyle().getDataFormatString());

View File

@ -113,7 +113,7 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
}
Cell readCell = readRow.getCell(0);
//noinspection deprecation
if(readCell.getCellTypeEnum() == CellType.NUMERIC) {
if(readCell.getCellType() == CellType.NUMERIC) {
assertEquals(expect, Double.toString(readCell.getNumericCellValue()));
} else {
assertEquals(expect, readCell.getStringCellValue());
@ -413,7 +413,7 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
assertNotNull(row);
Cell cell = row.getCell(cellAddress.getColumn());
assertNotNull(cell);
assertEquals(CellType.FORMULA, cell.getCellTypeEnum());
assertEquals(CellType.FORMULA, cell.getCellType());
return cell.getCellFormula();
}

View File

@ -129,31 +129,31 @@ public final class TestHyperlink {
hl1 = tb1.getTextParagraphs().get(0).getTextRuns().get(0).getHyperlink();
assertNotNull(hl1);
assertEquals("dev@poi.apache.org", hl1.getLabel());
assertEquals(HyperlinkType.EMAIL, hl1.getTypeEnum());
assertEquals(HyperlinkType.EMAIL, hl1.getType());
HSLFTextBox tb2 = (HSLFTextBox)slides.get(1).getShapes().get(0);
hl2 = tb2.getTextParagraphs().get(0).getTextRuns().get(0).getHyperlink();
assertNotNull(hl2);
assertEquals(InteractiveInfoAtom.LINK_LastSlide, hl2.getInfo().getInteractiveInfoAtom().getHyperlinkType());
assertEquals(HyperlinkType.DOCUMENT, hl2.getTypeEnum());
assertEquals(HyperlinkType.DOCUMENT, hl2.getType());
HSLFTextBox tb3 = (HSLFTextBox)slides.get(2).getShapes().get(0);
hl3 = tb3.getTextParagraphs().get(0).getTextRuns().get(1).getHyperlink();
assertNotNull(hl3);
assertEquals(ppt2.getSlides().get(0)._getSheetNumber(), Integer.parseInt(hl3.getAddress().split(",")[0]));
assertEquals(HyperlinkType.DOCUMENT, hl3.getTypeEnum());
assertEquals(HyperlinkType.DOCUMENT, hl3.getType());
HSLFTextBox tb4 = (HSLFTextBox)slides.get(3).getShapes().get(0);
hl4 = tb4.getTextParagraphs().get(0).getTextRuns().get(0).getHyperlink();
assertNotNull(hl4);
assertEquals("http://poi.apache.org", hl4.getLabel());
assertEquals(HyperlinkType.URL, hl4.getTypeEnum());
assertEquals(HyperlinkType.URL, hl4.getType());
tb5 = (HSLFTextBox)slides.get(4).getShapes().get(0);
hl5 = tb5.getHyperlink();
assertNotNull(hl5);
assertEquals(InteractiveInfoAtom.LINK_FirstSlide, hl5.getInfo().getInteractiveInfoAtom().getHyperlinkType());
assertEquals(HyperlinkType.DOCUMENT, hl5.getTypeEnum());
assertEquals(HyperlinkType.DOCUMENT, hl5.getType());
ppt2.close();
}

View File

@ -870,7 +870,7 @@ public final class TestBugs {
assertEquals(hlRun.getId(), hlShape.getId());
assertEquals(hlRun.getAddress(), hlShape.getAddress());
assertEquals(hlRun.getLabel(), hlShape.getLabel());
assertEquals(hlRun.getTypeEnum(), hlShape.getTypeEnum());
assertEquals(hlRun.getType(), hlShape.getType());
assertEquals(hlRun.getStartIndex(), hlShape.getStartIndex());
assertEquals(hlRun.getEndIndex(), hlShape.getEndIndex());

View File

@ -99,7 +99,7 @@ public final class TestFormulaParserEval extends TestCase {
}
throw e;
}
assertEquals(CellType.NUMERIC, result.getCellTypeEnum());
assertEquals(CellType.NUMERIC, result.getCellType());
assertEquals(42.0, result.getNumberValue(), 0.0);
}
}

View File

@ -80,7 +80,7 @@ public final class TestRVA {
break;
}
HSSFCell cell = row.getCell(0);
if (cell == null || cell.getCellTypeEnum() == CellType.BLANK) {
if (cell == null || cell.getCellType() == CellType.BLANK) {
break;
}

View File

@ -228,7 +228,7 @@ public final class TestSharedFormulaRecord extends TestCase {
private static void confirmCellEvaluation(HSSFWorkbook wb, HSSFCell cell, double expectedValue) {
HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
CellValue cv = fe.evaluate(cell);
assertEquals(CellType.NUMERIC, cv.getCellTypeEnum());
assertEquals(CellType.NUMERIC, cv.getCellType());
assertEquals(expectedValue, cv.getNumberValue(), 0.0);
}

View File

@ -68,7 +68,7 @@ public final class TestBug42464 {
Iterator<Cell> it = row.cellIterator();
while(it.hasNext()) {
HSSFCell cell = (HSSFCell)it.next();
if(cell.getCellTypeEnum() != CellType.FORMULA) {
if(cell.getCellType() != CellType.FORMULA) {
continue;
}
FormulaRecordAggregate record = (FormulaRecordAggregate) cell.getCellValueRecord();

View File

@ -51,7 +51,7 @@ public class TestExternalReferenceChange extends TestCase {
HSSFSheet lSheet = mainWorkbook.getSheetAt(0);
HSSFCell lA1Cell = lSheet.getRow(0).getCell(0);
assertEquals(CellType.FORMULA, lA1Cell.getCellTypeEnum());
assertEquals(CellType.FORMULA, lA1Cell.getCellType());
HSSFFormulaEvaluator lMainWorkbookEvaluator = new HSSFFormulaEvaluator(mainWorkbook);
HSSFFormulaEvaluator lSourceEvaluator = new HSSFFormulaEvaluator(sourceWorkbook);

View File

@ -384,7 +384,7 @@ public final class TestHSSFDataFormatter {
HSSFRow row = sheet.getRow(0);
HSSFCell cellA1 = row.getCell(0);
assertEquals(CellType.NUMERIC, cellA1.getCellTypeEnum());
assertEquals(CellType.NUMERIC, cellA1.getCellType());
assertEquals(2345.0, cellA1.getNumericCellValue(), 0.0001);
assertEquals("@", cellA1.getCellStyle().getDataFormatString());

View File

@ -392,7 +392,7 @@ public final class TestWorkbook {
HSSFSheet s = wb.getSheetAt(0);
HSSFCell c = s.getRow(0).getCell(0);
assertEquals(CellType.NUMERIC, c.getCellTypeEnum());
assertEquals(CellType.NUMERIC, c.getCellType());
wb.close();
}

View File

@ -78,18 +78,18 @@ public class TestIfError extends TestCase {
FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
assertEquals("Checks that the cell is numeric",
CellType.NUMERIC, evaluator.evaluate(cell1).getCellTypeEnum());
CellType.NUMERIC, evaluator.evaluate(cell1).getCellType());
assertEquals("Divides 210 by 35 and returns 6.0",
6.0, evaluator.evaluate(cell1).getNumberValue(), accuracy);
assertEquals("Checks that the cell is numeric",
CellType.STRING, evaluator.evaluate(cell2).getCellTypeEnum());
CellType.STRING, evaluator.evaluate(cell2).getCellType());
assertEquals("Rounds -10 to a nearest multiple of -3 (-9)",
"Error in calculation", evaluator.evaluate(cell2).getStringValue());
assertEquals("Check that C1 returns string",
CellType.STRING, evaluator.evaluate(cell3).getCellTypeEnum());
CellType.STRING, evaluator.evaluate(cell3).getCellType());
assertEquals("Check that C1 returns string \"error\"",
"error", evaluator.evaluate(cell3).getStringValue());
}

View File

@ -63,7 +63,7 @@ public final class TestYearFracCalculatorFromSpreadsheet {
HSSFRow row = (HSSFRow) rowIterator.next();
HSSFCell cell = row.getCell(SS.YEARFRAC_FORMULA_COLUMN);
if (cell == null || cell.getCellTypeEnum() != CellType.FORMULA) {
if (cell == null || cell.getCellType() != CellType.FORMULA) {
continue;
}
processRow(row, cell, formulaEvaluator);

View File

@ -58,7 +58,7 @@ public final class TestFormulaBugs {
FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
CellValue cv = fe.evaluate(cell);
assertEquals(CellType.NUMERIC, cv.getCellTypeEnum());
assertEquals(CellType.NUMERIC, cv.getCellType());
assertEquals(3.0, cv.getNumberValue(), 0.0);
wb.close();
@ -106,11 +106,11 @@ public final class TestFormulaBugs {
FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
CellValue cv;
cv = fe.evaluate(cell);
assertEquals(CellType.NUMERIC, cv.getCellTypeEnum());
assertEquals(CellType.NUMERIC, cv.getCellType());
assertEquals(1.0, cv.getNumberValue(), 0.0);
cv = fe.evaluate(row.getCell(1));
assertEquals(CellType.BOOLEAN, cv.getCellTypeEnum());
assertEquals(CellType.BOOLEAN, cv.getCellType());
assertEquals(true, cv.getBooleanValue());
wb.close();
@ -160,7 +160,7 @@ public final class TestFormulaBugs {
FormulaEvaluator fe = wb.getCreationHelper().createFormulaEvaluator();
CellValue cv = fe.evaluate(cell);
assertEquals(CellType.NUMERIC, cv.getCellTypeEnum());
assertEquals(CellType.NUMERIC, cv.getCellType());
assertEquals(expectedResult, cv.getNumberValue(), 0.0);
wb.close();

View File

@ -78,7 +78,7 @@ public final class TestPercentEval extends TestCase {
// else some other unexpected error
throw e;
}
assertEquals(CellType.NUMERIC, cv.getCellTypeEnum());
assertEquals(CellType.NUMERIC, cv.getCellType());
assertEquals(0.5, cv.getNumberValue(), 0.0);
}
}

View File

@ -73,7 +73,7 @@ public final class TestAddress extends TestCase {
cell.setCellFormula(formulaText);
fe.notifyUpdateCell(cell);
CellValue result = fe.evaluate(cell);
assertEquals(result.getCellTypeEnum(), CellType.STRING);
assertEquals(result.getCellType(), CellType.STRING);
assertEquals(expectedResult, result.getStringValue());
}
}

View File

@ -104,7 +104,7 @@ public final class TestCalendarFieldFunction extends TestCase {
cell11.setCellFormula(formulaText);
evaluator.clearAllCachedResultValues();
CellValue cv = evaluator.evaluate(cell11);
if (cv.getCellTypeEnum() != CellType.NUMERIC) {
if (cv.getCellType() != CellType.NUMERIC) {
throw new AssertionFailedError("Wrong result type: " + cv.formatAsString());
}
double actualValue = cv.getNumberValue();

View File

@ -60,7 +60,7 @@ public final class TestClean extends TestCase {
cell.setCellFormula(formulaText);
fe.notifyUpdateCell(cell);
CellValue result = fe.evaluate(cell);
assertEquals(result.getCellTypeEnum(), CellType.STRING);
assertEquals(result.getCellType(), CellType.STRING);
assertEquals(expectedResult, result.getStringValue());
}
}

View File

@ -128,7 +128,7 @@ public final class TestIrr extends TestCase {
private static void assertFormulaResult(CellValue cv, HSSFCell cell){
double actualValue = cv.getNumberValue();
double expectedValue = cell.getNumericCellValue(); // cached formula result calculated by Excel
assertEquals("Invalid formula result: " + cv, CellType.NUMERIC, cv.getCellTypeEnum());
assertEquals("Invalid formula result: " + cv, CellType.NUMERIC, cv.getCellType());
assertEquals(expectedValue, actualValue, 1E-4); // should agree within 0.01%
}
}

View File

@ -750,7 +750,7 @@ public abstract class BaseTestSheetShiftRows {
private void verifyHyperlink(Cell cell, HyperlinkType linkType, String ref) {
assertTrue(cellHasHyperlink(cell));
Hyperlink link = cell.getHyperlink();
assertEquals(linkType, link.getTypeEnum());
assertEquals(linkType, link.getType());
assertEquals(ref, link.getAddress());
}