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:
parent
62a4298292
commit
b79412c217
@ -63,7 +63,7 @@ import java.text.*;
|
|||||||
* @author James May (james dot may at fmr dot com)
|
* @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 "#" */
|
/** Pattern to find a number format: "0" or "#" */
|
||||||
private static final Pattern numPattern = Pattern.compile("[0#]+");
|
private static final Pattern numPattern = Pattern.compile("[0#]+");
|
||||||
@ -469,28 +469,20 @@ public class DataFormatter {
|
|||||||
* @param evaluator The FormulaEvaluator (can be null)
|
* @param evaluator The FormulaEvaluator (can be null)
|
||||||
* @return a string value of the cell
|
* @return a string value of the cell
|
||||||
*/
|
*/
|
||||||
public String formatCellValue(Cell cell,
|
public String formatCellValue(Cell cell, FormulaEvaluator evaluator) {
|
||||||
FormulaEvaluator evaluator) throws IllegalArgumentException {
|
|
||||||
|
|
||||||
if (cell == null) {
|
if (cell == null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
int cellType = cell.getCellType();
|
int cellType = cell.getCellType();
|
||||||
if (evaluator != null && cellType == Cell.CELL_TYPE_FORMULA) {
|
if (cellType == Cell.CELL_TYPE_FORMULA) {
|
||||||
try {
|
if (evaluator == null) {
|
||||||
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
|
|
||||||
return cell.getCellFormula();
|
return cell.getCellFormula();
|
||||||
|
}
|
||||||
|
cellType = evaluator.evaluateFormulaCell(cell);
|
||||||
|
}
|
||||||
|
switch (cellType) {
|
||||||
case Cell.CELL_TYPE_NUMERIC :
|
case Cell.CELL_TYPE_NUMERIC :
|
||||||
|
|
||||||
if (DateUtil.isCellDateFormatted(cell)) {
|
if (DateUtil.isCellDateFormatted(cell)) {
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
package org.apache.poi.ss.usermodel;
|
package org.apache.poi.ss.usermodel;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
|
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||||
@ -98,6 +100,11 @@ public interface Cell {
|
|||||||
|
|
||||||
boolean getBooleanCellValue();
|
boolean getBooleanCellValue();
|
||||||
double getNumericCellValue();
|
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();
|
HSSFRichTextString getRichStringCellValue();
|
||||||
|
|
||||||
void setCellType(int cellType);
|
void setCellType(int cellType);
|
||||||
|
Loading…
Reference in New Issue
Block a user