mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
partially revert cell toString changes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1924533 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
82388de909
commit
71dcabc947
@ -721,8 +721,6 @@ public class SXSSFCell extends CellBase {
|
||||
}
|
||||
//end of interface implementation
|
||||
|
||||
private static final DataFormatter DATA_FORMATTER = new DataFormatter();
|
||||
|
||||
/**
|
||||
* Returns a string representation of the cell
|
||||
* <p>
|
||||
@ -743,8 +741,14 @@ public class SXSSFCell extends CellBase {
|
||||
case FORMULA:
|
||||
return getCellFormula();
|
||||
case NUMERIC:
|
||||
if (DateUtil.isCellDateFormatted(this)) {
|
||||
DataFormatter df = new DataFormatter();
|
||||
df.setUseCachedValuesForFormulaCells(true);
|
||||
return df.formatCellValue(this);
|
||||
}
|
||||
return Double.toString(getNumericCellValue());
|
||||
case STRING:
|
||||
return DATA_FORMATTER.formatCellValue(this);
|
||||
return getRichStringCellValue().toString();
|
||||
default:
|
||||
return "Unknown Cell Type: " + getCellType();
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@ import org.apache.poi.ss.util.CellUtil;
|
||||
import org.apache.poi.util.Beta;
|
||||
import org.apache.poi.util.ExceptionUtil;
|
||||
import org.apache.poi.util.Internal;
|
||||
import org.apache.poi.util.LocaleUtil;
|
||||
import org.apache.poi.xssf.model.CalculationChain;
|
||||
import org.apache.poi.xssf.model.SharedStringsTable;
|
||||
import org.apache.poi.xssf.model.StylesTable;
|
||||
@ -924,8 +925,6 @@ public final class XSSFCell extends CellBase {
|
||||
}
|
||||
}
|
||||
|
||||
private static final DataFormatter DATA_FORMATTER = new DataFormatter();
|
||||
|
||||
/**
|
||||
* Returns a string representation of the cell
|
||||
* <p>
|
||||
@ -938,8 +937,14 @@ public final class XSSFCell extends CellBase {
|
||||
public String toString() {
|
||||
switch (getCellType()) {
|
||||
case NUMERIC:
|
||||
if (DateUtil.isCellDateFormatted(this)) {
|
||||
DataFormatter df = new DataFormatter();
|
||||
df.setUseCachedValuesForFormulaCells(true);
|
||||
return df.formatCellValue(this);
|
||||
}
|
||||
return Double.toString(getNumericCellValue());
|
||||
case STRING:
|
||||
return DATA_FORMATTER.formatCellValue(this);
|
||||
return getRichStringCellValue().toString();
|
||||
case FORMULA:
|
||||
return getCellFormula();
|
||||
case BLANK:
|
||||
|
||||
@ -55,6 +55,7 @@ import org.apache.poi.ss.usermodel.RichTextString;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.CellReference;
|
||||
import org.apache.poi.ss.util.NumberToTextConverter;
|
||||
import org.apache.poi.util.LocaleUtil;
|
||||
|
||||
/**
|
||||
* High level representation of a cell in a row of a spreadsheet.
|
||||
@ -1020,8 +1021,6 @@ public class HSSFCell extends CellBase {
|
||||
_sheet.getSheet().setActiveCellCol(col);
|
||||
}
|
||||
|
||||
private static final DataFormatter DATA_FORMATTER = new DataFormatter();
|
||||
|
||||
/**
|
||||
* Returns a string representation of the cell
|
||||
*
|
||||
@ -1045,8 +1044,14 @@ public class HSSFCell extends CellBase {
|
||||
case FORMULA:
|
||||
return getCellFormula();
|
||||
case NUMERIC:
|
||||
if (DateUtil.isCellDateFormatted(this)) {
|
||||
DataFormatter df = new DataFormatter();
|
||||
df.setUseCachedValuesForFormulaCells(true);
|
||||
return df.formatCellValue(this);
|
||||
}
|
||||
return Double.toString(getNumericCellValue());
|
||||
case STRING:
|
||||
return DATA_FORMATTER.formatCellValue(this);
|
||||
return getRichStringCellValue().toString();
|
||||
default:
|
||||
return "Unknown Cell Type: " + getCellType();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user