Fixed compilation error introduced in r708982

git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@709260 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Josh Micich 2008-10-30 21:55:50 +00:00
parent 62a4298292
commit b79412c217
2 changed files with 15 additions and 16 deletions

View File

@ -63,7 +63,7 @@ import java.text.*;
* @author James May (james dot may at fmr dot com)
*
*/
public class DataFormatter {
public final class DataFormatter {
/** Pattern to find a number format: "0" or "#" */
private static final Pattern numPattern = Pattern.compile("[0#]+");
@ -469,28 +469,20 @@ public class DataFormatter {
* @param evaluator The FormulaEvaluator (can be null)
* @return a string value of the cell
*/
public String formatCellValue(Cell cell,
FormulaEvaluator evaluator) throws IllegalArgumentException {
public String formatCellValue(Cell cell, FormulaEvaluator evaluator) {
if (cell == null) {
return "";
}
int cellType = cell.getCellType();
if (evaluator != null && cellType == Cell.CELL_TYPE_FORMULA) {
try {
cellType = evaluator.evaluateFormulaCell(cell);
} catch (RuntimeException e) {
throw new RuntimeException("Did you forget to set the current" +
" row on the FormulaEvaluator?", e);
}
}
switch (cellType)
{
case Cell.CELL_TYPE_FORMULA :
// should only occur if evaluator is null
if (cellType == Cell.CELL_TYPE_FORMULA) {
if (evaluator == null) {
return cell.getCellFormula();
}
cellType = evaluator.evaluateFormulaCell(cell);
}
switch (cellType) {
case Cell.CELL_TYPE_NUMERIC :
if (DateUtil.isCellDateFormatted(cell)) {

View File

@ -17,6 +17,8 @@
package org.apache.poi.ss.usermodel;
import java.util.Date;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFSheet;
@ -98,6 +100,11 @@ public interface Cell {
boolean getBooleanCellValue();
double getNumericCellValue();
/**
* get the value of the cell as a date. For strings we throw an exception.
* For blank cells we return a null.
*/
Date getDateCellValue();
HSSFRichTextString getRichStringCellValue();
void setCellType(int cellType);