This commit is contained in:
MarkBaker 2015-05-17 10:23:26 +01:00
commit b531fd487e
5 changed files with 2794 additions and 1850 deletions

View File

@ -95,7 +95,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
/** /**
* Create a new PHPExcel_Reader_CSV * Create a new PHPExcel_Reader_CSV
*/ */
public function __construct() { public function __construct()
{
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter(); $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
} }
@ -106,7 +107,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
*/ */
protected function _isValidFormat() protected function _isValidFormat()
{ {
return TRUE; return true;
} }
/** /**
@ -175,7 +176,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
// Open file // Open file
$this->_openFile($pFilename); $this->_openFile($pFilename);
if (!$this->_isValidFormat()) { if (!$this->_isValidFormat()) {
fclose ($this->_fileHandle); fclose($this->_fileHandle);
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
} }
$fileHandle = $this->_fileHandle; $fileHandle = $this->_fileHandle;
@ -193,7 +194,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
$worksheetInfo[0]['totalColumns'] = 0; $worksheetInfo[0]['totalColumns'] = 0;
// Loop through each line of the file in turn // Loop through each line of the file in turn
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) { while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== false) {
$worksheetInfo[0]['totalRows']++; $worksheetInfo[0]['totalRows']++;
$worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1); $worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1);
} }
@ -239,7 +240,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
// Open file // Open file
$this->_openFile($pFilename); $this->_openFile($pFilename);
if (!$this->_isValidFormat()) { if (!$this->_isValidFormat()) {
fclose ($this->_fileHandle); fclose($this->_fileHandle);
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file."); throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
} }
$fileHandle = $this->_fileHandle; $fileHandle = $this->_fileHandle;
@ -264,7 +265,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
} }
// Loop through each line of the file in turn // Loop through each line of the file in turn
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) { while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== false) {
$columnLetter = 'A'; $columnLetter = 'A';
foreach ($rowData as $rowDatum) { foreach ($rowData as $rowDatum) {
if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) { if ($rowDatum != '' && $this->_readFilter->readCell($columnLetter, $currentRow)) {
@ -302,7 +303,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @return string * @return string
*/ */
public function getDelimiter() { public function getDelimiter()
{
return $this->_delimiter; return $this->_delimiter;
} }
@ -312,7 +314,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @param string $pValue Delimiter, defaults to , * @param string $pValue Delimiter, defaults to ,
* @return PHPExcel_Reader_CSV * @return PHPExcel_Reader_CSV
*/ */
public function setDelimiter($pValue = ',') { public function setDelimiter($pValue = ',')
{
$this->_delimiter = $pValue; $this->_delimiter = $pValue;
return $this; return $this;
} }
@ -322,7 +325,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @return string * @return string
*/ */
public function getEnclosure() { public function getEnclosure()
{
return $this->_enclosure; return $this->_enclosure;
} }
@ -332,7 +336,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @param string $pValue Enclosure, defaults to " * @param string $pValue Enclosure, defaults to "
* @return PHPExcel_Reader_CSV * @return PHPExcel_Reader_CSV
*/ */
public function setEnclosure($pValue = '"') { public function setEnclosure($pValue = '"')
{
if ($pValue == '') { if ($pValue == '') {
$pValue = '"'; $pValue = '"';
} }
@ -345,7 +350,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @return integer * @return integer
*/ */
public function getSheetIndex() { public function getSheetIndex()
{
return $this->_sheetIndex; return $this->_sheetIndex;
} }
@ -355,7 +361,8 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* @param integer $pValue Sheet index * @param integer $pValue Sheet index
* @return PHPExcel_Reader_CSV * @return PHPExcel_Reader_CSV
*/ */
public function setSheetIndex($pValue = 0) { public function setSheetIndex($pValue = 0)
{
$this->_sheetIndex = $pValue; $this->_sheetIndex = $pValue;
return $this; return $this;
} }
@ -365,7 +372,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @param boolean $contiguous * @param boolean $contiguous
*/ */
public function setContiguous($contiguous = FALSE) public function setContiguous($contiguous = false)
{ {
$this->_contiguous = (bool) $contiguous; $this->_contiguous = (bool) $contiguous;
if (!$contiguous) { if (!$contiguous) {
@ -380,8 +387,7 @@ class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_R
* *
* @return boolean * @return boolean
*/ */
public function getContiguous() { public function getContiguous(){
return $this->_contiguous; return $this->_contiguous;
} }
} }

View File

@ -52,7 +52,8 @@ class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
* @param $worksheetName Optional worksheet name * @param $worksheetName Optional worksheet name
* @return boolean * @return boolean
*/ */
public function readCell($column, $row, $worksheetName = '') { public function readCell($column, $row, $worksheetName = '')
{
return true; return true;
} }
} }

View File

@ -239,7 +239,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
return $this->loadIntoExisting($pFilename, $objPHPExcel); return $this->loadIntoExisting($pFilename, $objPHPExcel);
} }
protected static function identifyFixedStyleValue($styleList,&$styleAttributeValue) protected static function identifyFixedStyleValue($styleList, &$styleAttributeValue)
{ {
$styleAttributeValue = strtolower($styleAttributeValue); $styleAttributeValue = strtolower($styleAttributeValue);
foreach ($styleList as $style) { foreach ($styleList as $style) {
@ -251,18 +251,18 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
return false; return false;
} }
/** /**
* pixel units to excel width units(units of 1/256th of a character width) * pixel units to excel width units(units of 1/256th of a character width)
* @param pxs * @param pxs
* @return * @return
*/ */
protected static function _pixel2WidthUnits($pxs) protected static function _pixel2WidthUnits($pxs)
{ {
$UNIT_OFFSET_MAP = array(0, 36, 73, 109, 146, 182, 219); $UNIT_OFFSET_MAP = array(0, 36, 73, 109, 146, 182, 219);
$widthUnits = 256 * ($pxs / 7); $widthUnits = 256 * ($pxs / 7);
$widthUnits += $UNIT_OFFSET_MAP[($pxs % 7)]; $widthUnits += $UNIT_OFFSET_MAP[($pxs % 7)];
return $widthUnits; return $widthUnits;
} }
/** /**
@ -337,39 +337,39 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
if (isset($xml->DocumentProperties[0])) { if (isset($xml->DocumentProperties[0])) {
foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) { foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) {
switch ($propertyName) { switch ($propertyName) {
case 'Title' : case 'Title':
$docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setTitle(self::_convertStringEncoding($propertyValue, $this->_charSet));
break; break;
case 'Subject' : case 'Subject':
$docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setSubject(self::_convertStringEncoding($propertyValue, $this->_charSet));
break; break;
case 'Author' : case 'Author':
$docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setCreator(self::_convertStringEncoding($propertyValue, $this->_charSet));
break; break;
case 'Created' : case 'Created':
$creationDate = strtotime($propertyValue); $creationDate = strtotime($propertyValue);
$docProps->setCreated($creationDate); $docProps->setCreated($creationDate);
break; break;
case 'LastAuthor' : case 'LastAuthor':
$docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setLastModifiedBy(self::_convertStringEncoding($propertyValue, $this->_charSet));
break; break;
case 'LastSaved' : case 'LastSaved':
$lastSaveDate = strtotime($propertyValue); $lastSaveDate = strtotime($propertyValue);
$docProps->setModified($lastSaveDate); $docProps->setModified($lastSaveDate);
break; break;
case 'Company' : case 'Company':
$docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setCompany(self::_convertStringEncoding($propertyValue, $this->_charSet));
break; break;
case 'Category' : case 'Category':
$docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setCategory(self::_convertStringEncoding($propertyValue, $this->_charSet));
break; break;
case 'Manager' : case 'Manager':
$docProps->setManager(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setManager(self::_convertStringEncoding($propertyValue, $this->_charSet));
break; break;
case 'Keywords' : case 'Keywords':
$docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setKeywords(self::_convertStringEncoding($propertyValue, $this->_charSet));
break; break;
case 'Description' : case 'Description':
$docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->_charSet)); $docProps->setDescription(self::_convertStringEncoding($propertyValue, $this->_charSet));
break; break;
} }
@ -378,26 +378,26 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
if (isset($xml->CustomDocumentProperties)) { if (isset($xml->CustomDocumentProperties)) {
foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) { foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) {
$propertyAttributes = $propertyValue->attributes($namespaces['dt']); $propertyAttributes = $propertyValue->attributes($namespaces['dt']);
$propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/','PHPExcel_Reader_Excel2003XML::_hex2str', $propertyName); $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', 'PHPExcel_Reader_Excel2003XML::_hex2str', $propertyName);
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN; $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN;
switch ((string) $propertyAttributes) { switch ((string) $propertyAttributes) {
case 'string' : case 'string':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING; $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
$propertyValue = trim($propertyValue); $propertyValue = trim($propertyValue);
break; break;
case 'boolean' : case 'boolean':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN; $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
$propertyValue = (bool) $propertyValue; $propertyValue = (bool) $propertyValue;
break; break;
case 'integer' : case 'integer':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_INTEGER; $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_INTEGER;
$propertyValue = intval($propertyValue); $propertyValue = intval($propertyValue);
break; break;
case 'float' : case 'float':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT; $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
$propertyValue = floatval($propertyValue); $propertyValue = floatval($propertyValue);
break; break;
case 'dateTime.tz' : case 'dateTime.tz':
$propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE; $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
$propertyValue = strtotime(trim($propertyValue)); $propertyValue = strtotime(trim($propertyValue));
break; break;
@ -419,46 +419,46 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
$styleAttributes = $styleData->attributes($namespaces['ss']); $styleAttributes = $styleData->attributes($namespaces['ss']);
// echo $styleType.'<br />'; // echo $styleType.'<br />';
switch ($styleType) { switch ($styleType) {
case 'Alignment' : case 'Alignment':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
$styleAttributeValue = (string) $styleAttributeValue; $styleAttributeValue = (string) $styleAttributeValue;
switch ($styleAttributeKey) { switch ($styleAttributeKey) {
case 'Vertical' : case 'Vertical':
if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) { if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) {
$this->_styles[$styleID]['alignment']['vertical'] = $styleAttributeValue; $this->_styles[$styleID]['alignment']['vertical'] = $styleAttributeValue;
} }
break; break;
case 'Horizontal' : case 'Horizontal':
if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) { if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) {
$this->_styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue; $this->_styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue;
} }
break; break;
case 'WrapText' : case 'WrapText':
$this->_styles[$styleID]['alignment']['wrap'] = true; $this->_styles[$styleID]['alignment']['wrap'] = true;
break; break;
} }
} }
break; break;
case 'Borders' : case 'Borders':
foreach ($styleData->Border as $borderStyle) { foreach ($styleData->Border as $borderStyle) {
$borderAttributes = $borderStyle->attributes($namespaces['ss']); $borderAttributes = $borderStyle->attributes($namespaces['ss']);
$thisBorder = array(); $thisBorder = array();
foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) { foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) {
// echo $borderStyleKey.' = '.$borderStyleValue.'<br />'; // echo $borderStyleKey.' = '.$borderStyleValue.'<br />';
switch ($borderStyleKey) { switch ($borderStyleKey) {
case 'LineStyle' : case 'LineStyle':
$thisBorder['style'] = PHPExcel_Style_Border::BORDER_MEDIUM; $thisBorder['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
// $thisBorder['style'] = $borderStyleValue; // $thisBorder['style'] = $borderStyleValue;
break; break;
case 'Weight' : case 'Weight':
// $thisBorder['style'] = $borderStyleValue; // $thisBorder['style'] = $borderStyleValue;
break; break;
case 'Position' : case 'Position':
$borderPosition = strtolower($borderStyleValue); $borderPosition = strtolower($borderStyleValue);
break; break;
case 'Color' : case 'Color':
$borderColour = substr($borderStyleValue,1); $borderColour = substr($borderStyleValue, 1);
$thisBorder['color']['rgb'] = $borderColour; $thisBorder['color']['rgb'] = $borderColour;
break; break;
} }
@ -470,27 +470,27 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
} }
} }
break; break;
case 'Font' : case 'Font':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
$styleAttributeValue = (string) $styleAttributeValue; $styleAttributeValue = (string) $styleAttributeValue;
switch ($styleAttributeKey) { switch ($styleAttributeKey) {
case 'FontName' : case 'FontName':
$this->_styles[$styleID]['font']['name'] = $styleAttributeValue; $this->_styles[$styleID]['font']['name'] = $styleAttributeValue;
break; break;
case 'Size' : case 'Size':
$this->_styles[$styleID]['font']['size'] = $styleAttributeValue; $this->_styles[$styleID]['font']['size'] = $styleAttributeValue;
break; break;
case 'Color' : case 'Color':
$this->_styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue,1); $this->_styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue, 1);
break; break;
case 'Bold' : case 'Bold':
$this->_styles[$styleID]['font']['bold'] = true; $this->_styles[$styleID]['font']['bold'] = true;
break; break;
case 'Italic' : case 'Italic':
$this->_styles[$styleID]['font']['italic'] = true; $this->_styles[$styleID]['font']['italic'] = true;
break; break;
case 'Underline' : case 'Underline':
if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) { if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) {
$this->_styles[$styleID]['font']['underline'] = $styleAttributeValue; $this->_styles[$styleID]['font']['underline'] = $styleAttributeValue;
} }
@ -498,22 +498,22 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
} }
} }
break; break;
case 'Interior' : case 'Interior':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
switch ($styleAttributeKey) { switch ($styleAttributeKey) {
case 'Color' : case 'Color':
$this->_styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue,1); $this->_styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1);
break; break;
} }
} }
break; break;
case 'NumberFormat' : case 'NumberFormat':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
$styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue); $styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue);
switch ($styleAttributeValue) { switch ($styleAttributeValue) {
case 'Short Date' : case 'Short Date':
$styleAttributeValue = 'dd/mm/yyyy'; $styleAttributeValue = 'dd/mm/yyyy';
break; break;
} }
@ -522,7 +522,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
} }
} }
break; break;
case 'Protection' : case 'Protection':
foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) { foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />'; // echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
} }
@ -555,7 +555,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in // Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in
// formula cells... during the load, all formulae should be correct, and we're simply bringing // formula cells... during the load, all formulae should be correct, and we're simply bringing
// the worksheet name in line with the formula, not the reverse // the worksheet name in line with the formula, not the reverse
$objPHPExcel->getActiveSheet()->setTitle($worksheetName,false); $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
} }
$columnID = 'A'; $columnID = 'A';
@ -640,26 +640,26 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
const TYPE_INLINE = 'inlineStr'; const TYPE_INLINE = 'inlineStr';
const TYPE_ERROR = 'e'; const TYPE_ERROR = 'e';
*/ */
case 'String' : case 'String':
$cellValue = self::_convertStringEncoding($cellValue, $this->_charSet); $cellValue = self::_convertStringEncoding($cellValue, $this->_charSet);
$type = PHPExcel_Cell_DataType::TYPE_STRING; $type = PHPExcel_Cell_DataType::TYPE_STRING;
break; break;
case 'Number' : case 'Number':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$cellValue = (float) $cellValue; $cellValue = (float) $cellValue;
if (floor($cellValue) == $cellValue) { if (floor($cellValue) == $cellValue) {
$cellValue = (integer) $cellValue; $cellValue = (integer) $cellValue;
} }
break; break;
case 'Boolean' : case 'Boolean':
$type = PHPExcel_Cell_DataType::TYPE_BOOL; $type = PHPExcel_Cell_DataType::TYPE_BOOL;
$cellValue = ($cellValue != 0); $cellValue = ($cellValue != 0);
break; break;
case 'DateTime' : case 'DateTime':
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC; $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$cellValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellValue)); $cellValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellValue));
break; break;
case 'Error' : case 'Error':
$type = PHPExcel_Cell_DataType::TYPE_ERROR; $type = PHPExcel_Cell_DataType::TYPE_ERROR;
break; break;
} }
@ -669,15 +669,15 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
// echo 'FORMULA<br />'; // echo 'FORMULA<br />';
$type = PHPExcel_Cell_DataType::TYPE_FORMULA; $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
$columnNumber = PHPExcel_Cell::columnIndexFromString($columnID); $columnNumber = PHPExcel_Cell::columnIndexFromString($columnID);
if (substr($cellDataFormula,0,3) == 'of:') { if (substr($cellDataFormula, 0, 3) == 'of:') {
$cellDataFormula = substr($cellDataFormula,3); $cellDataFormula = substr($cellDataFormula, 3);
// echo 'Before: ', $cellDataFormula,'<br />'; // echo 'Before: ', $cellDataFormula,'<br />';
$temp = explode('"', $cellDataFormula); $temp = explode('"', $cellDataFormula);
$key = false; $key = false;
foreach ($temp as &$value) { foreach ($temp as &$value) {
// Only replace in alternate array entries (i.e. non-quoted blocks) // Only replace in alternate array entries (i.e. non-quoted blocks)
if ($key = !$key) { if ($key = !$key) {
$value = str_replace(array('[.','.',']'),'', $value); $value = str_replace(array('[.', '.', ']'), '', $value);
} }
} }
} else { } else {
@ -688,7 +688,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
foreach ($temp as &$value) { foreach ($temp as &$value) {
// Only replace in alternate array entries (i.e. non-quoted blocks) // Only replace in alternate array entries (i.e. non-quoted blocks)
if ($key = !$key) { if ($key = !$key) {
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE); preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER + PREG_OFFSET_CAPTURE);
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way // Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
// through the formula from left to right. Reversing means that we work right to left.through // through the formula from left to right. Reversing means that we work right to left.through
// the formula // the formula
@ -703,7 +703,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
} }
// Bracketed R references are relative to the current row // Bracketed R references are relative to the current row
if ($rowReference{0} == '[') { if ($rowReference{0} == '[') {
$rowReference = $rowID + trim($rowReference,'[]'); $rowReference = $rowID + trim($rowReference, '[]');
} }
$columnReference = $cellReference[4][0]; $columnReference = $cellReference[4][0];
// Empty C reference is the current column // Empty C reference is the current column
@ -712,10 +712,10 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
} }
// Bracketed C references are relative to the current column // Bracketed C references are relative to the current column
if ($columnReference{0} == '[') { if ($columnReference{0} == '[') {
$columnReference = $columnNumber + trim($columnReference,'[]'); $columnReference = $columnNumber + trim($columnReference, '[]');
} }
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference; $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
$value = substr_replace($value, $A1CellReference, $cellReference[0][1],strlen($cellReference[0][0])); $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
} }
} }
} }
@ -749,7 +749,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
// echo $annotation,'<br />'; // echo $annotation,'<br />';
$annotation = strip_tags($node); $annotation = strip_tags($node);
// echo 'Annotation: ', $annotation,'<br />'; // echo 'Annotation: ', $annotation,'<br />';
$objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setAuthor(self::_convertStringEncoding($author , $this->_charSet))->setText($this->_parseRichText($annotation) ); $objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setAuthor(self::_convertStringEncoding($author, $this->_charSet))->setText($this->_parseRichText($annotation));
} }
if (($cellIsSet) && (isset($cell_ss['StyleID']))) { if (($cellIsSet) && (isset($cell_ss['StyleID']))) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff