Allow cell value type attribute of "str" in Excel2007 xlsx files as a synonym for type of "s"

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@65165 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2010-12-11 22:00:16 +00:00
parent 5168f49b36
commit 5a5e920444
3 changed files with 7 additions and 1 deletions

View File

@ -232,6 +232,8 @@ class PHPExcel_Cell
{ {
// set the value according to data type // set the value according to data type
switch ($pDataType) { switch ($pDataType) {
case PHPExcel_Cell_DataType::TYPE_STRING2:
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
case PHPExcel_Cell_DataType::TYPE_STRING: case PHPExcel_Cell_DataType::TYPE_STRING:
case PHPExcel_Cell_DataType::TYPE_NULL: case PHPExcel_Cell_DataType::TYPE_NULL:
case PHPExcel_Cell_DataType::TYPE_INLINE: case PHPExcel_Cell_DataType::TYPE_INLINE:
@ -343,6 +345,9 @@ class PHPExcel_Cell
*/ */
public function setDataType($pDataType = PHPExcel_Cell_DataType::TYPE_STRING) public function setDataType($pDataType = PHPExcel_Cell_DataType::TYPE_STRING)
{ {
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2)
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
$this->_dataType = $pDataType; $this->_dataType = $pDataType;
return $this->notifyCacheController(); return $this->notifyCacheController();

View File

@ -36,6 +36,7 @@
class PHPExcel_Cell_DataType class PHPExcel_Cell_DataType
{ {
/* Data types */ /* Data types */
const TYPE_STRING2 = 'str';
const TYPE_STRING = 's'; const TYPE_STRING = 's';
const TYPE_FORMULA = 'f'; const TYPE_FORMULA = 'f';
const TYPE_NUMERIC = 'n'; const TYPE_NUMERIC = 'n';

View File

@ -66,7 +66,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
!isset($aFlippedStringTable[$cell->getValue()]) && !isset($aFlippedStringTable[$cell->getValue()]) &&
!is_null($cell->getValue()) && !is_null($cell->getValue()) &&
$cell->getValue() !== '' && $cell->getValue() !== '' &&
($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL) ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING2 || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL)
) { ) {
$aStringTable[] = $cell->getValue(); $aStringTable[] = $cell->getValue();
$aFlippedStringTable[$cell->getValue()] = 1; $aFlippedStringTable[$cell->getValue()] = 1;