import java.util.Calendar;
import java.util.Date;
-import org.apache.poi.ss.formula.eval.ErrorEval;
-import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.formula.FormulaParseException;
+import org.apache.poi.ss.formula.eval.ErrorEval;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Comment;
+import org.apache.poi.ss.usermodel.DateUtil;
+import org.apache.poi.ss.usermodel.FormulaError;
+import org.apache.poi.ss.usermodel.Hyperlink;
+import org.apache.poi.ss.usermodel.RichTextString;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.usermodel.XSSFHyperlink;
* Errors are displayed as #ERR<errIdx>
* </p>
*/
+ @Override
public String toString() {
switch (getCellType()) {
case CELL_TYPE_BLANK:
case CELL_TYPE_STRING:
return getStringCellValue();
case CELL_TYPE_NUMERIC:
+ return Double.toString( getNumericCellValue() );
case CELL_TYPE_ERROR:
byte errVal = getErrorCellValue();
return FormulaError.forInt(errVal).getString();
{
super(value);
}
+ @Override
public int getType()
{
return COMMENT;
{
super(value);
}
+ @Override
public int getType()
{
return HYPERLINK;
{
return _value;
}
+ @Override
boolean isRichText()
{
return false;
static class RichTextValue extends StringValue
{
RichTextString _value;
+ @Override
public int getType()
{
return CELL_TYPE_STRING;
{
return _value;
}
+ @Override
boolean isRichText()
{
return true;
static class NumericFormulaValue extends FormulaValue
{
double _preEvaluatedValue;
+ @Override
int getFormulaType()
{
return CELL_TYPE_NUMERIC;
static class StringFormulaValue extends FormulaValue
{
String _preEvaluatedValue;
+ @Override
int getFormulaType()
{
return CELL_TYPE_STRING;
static class BooleanFormulaValue extends FormulaValue
{
boolean _preEvaluatedValue;
+ @Override
int getFormulaType()
{
return CELL_TYPE_BOOLEAN;
static class ErrorFormulaValue extends FormulaValue
{
byte _preEvaluatedValue;
+ @Override
int getFormulaType()
{
return CELL_TYPE_ERROR;
package org.apache.poi.xssf.streaming;
-import org.apache.poi.ss.usermodel.*;
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.poi.ss.usermodel.BaseTestCell;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.SXSSFITestDataProvider;
import org.apache.poi.xssf.XSSFITestDataProvider;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.xmlbeans.XmlCursor;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
-import javax.xml.namespace.QName;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
/**
*
*/
assertEquals("expected xml:spaces=\"preserve\" \"" + str + "\"", "preserve", t);
}
}
+
+ public void testBug55658SetNumericValue(){
+ Workbook wb = new SXSSFWorkbook();
+ Sheet sh = wb.createSheet();
+ Row row = sh.createRow(0);
+ Cell cell = row.createCell(0);
+ cell.setCellValue(Integer.valueOf(23));
+
+ cell.setCellValue("some");
+
+ cell = row.createCell(1);
+ cell.setCellValue(Integer.valueOf(23));
+
+ cell.setCellValue("24");
+
+ wb = _testDataProvider.writeOutAndReadBack(wb);
+
+ assertEquals("some", wb.getSheetAt(0).getRow(0).getCell(0).getStringCellValue());
+ assertEquals("24", wb.getSheetAt(0).getRow(0).getCell(1).getStringCellValue());
+ }
}