Fixed merge errors

This commit is contained in:
MarkBaker 2015-05-13 01:29:12 +01:00
parent 99b0beb721
commit 4a977f1848
5 changed files with 5 additions and 535 deletions

View File

@ -3657,301 +3657,6 @@ class PHPExcel_Calculation {
return strcmp($inversedStr1, $inversedStr2); return strcmp($inversedStr1, $inversedStr2);
} }
<<<<<<< HEAD
=======
private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) {
// Validate the two operands
if (!$this->_validateBinaryOperand($cellID,$operand1,$stack)) return FALSE;
if (!$this->_validateBinaryOperand($cellID,$operand2,$stack)) return FALSE;
// If either of the operands is a matrix, we need to treat them both as matrices
// (converting the other operand to a matrix if need be); then perform the required
// matrix operation
if ((is_array($operand1)) || (is_array($operand2))) {
// Ensure that both operands are arrays/matrices of the same size
self::_checkMatrixOperands($operand1, $operand2, 2);
try {
// Convert operand 1 from a PHP array to a matrix
$matrix = new PHPExcel_Shared_JAMA_Matrix($operand1);
// Perform the required operation against the operand 1 matrix, passing in operand 2
$matrixResult = $matrix->$matrixFunction($operand2);
$result = $matrixResult->getArray();
} catch (PHPExcel_Exception $ex) {
$this->_debugLog->writeDebugLog('JAMA Matrix Exception: ', $ex->getMessage());
$result = '#VALUE!';
}
} else {
if ((PHPExcel_Calculation_Functions::getCompatibilityMode() != PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) &&
((is_string($operand1) && !is_numeric($operand1) && strlen($operand1)>0) ||
(is_string($operand2) && !is_numeric($operand2) && strlen($operand2)>0))) {
$result = PHPExcel_Calculation_Functions::VALUE();
} else {
// If we're dealing with non-matrix operations, execute the necessary operation
switch ($operation) {
// Addition
case '+':
$result = $operand1 + $operand2;
break;
// Subtraction
case '-':
$result = $operand1 - $operand2;
break;
// Multiplication
case '*':
$result = $operand1 * $operand2;
break;
// Division
case '/':
if ($operand2 == 0) {
// Trap for Divide by Zero error
$stack->push('Value','#DIV/0!');
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails('#DIV/0!'));
return FALSE;
} else {
$result = $operand1 / $operand2;
}
break;
// Power
case '^':
$result = pow($operand1, $operand2);
break;
}
}
}
// Log the result details
$this->_debugLog->writeDebugLog('Evaluation Result is ', $this->_showTypeDetails($result));
// And push the result onto the stack
$stack->push('Value',$result);
return TRUE;
} // function _executeNumericBinaryOperation()
// trigger an error, but nicely, if need be
protected function _raiseFormulaError($errorMessage) {
$this->formulaError = $errorMessage;
$this->_cyclicReferenceStack->clear();
if (!$this->suppressFormulaErrors) throw new PHPExcel_Calculation_Exception($errorMessage);
trigger_error($errorMessage, E_USER_ERROR);
} // function _raiseFormulaError()
/**
* Extract range values
*
* @param string &$pRange String based range representation
* @param PHPExcel_Worksheet $pSheet Worksheet
* @param boolean $resetLog Flag indicating whether calculation log should be reset or not
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
* @throws PHPExcel_Calculation_Exception
*/
public function extractCellRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = NULL, $resetLog = TRUE) {
// Return value
$returnValue = array ();
// echo 'extractCellRange('.$pRange.')',PHP_EOL;
if ($pSheet !== NULL) {
$pSheetName = $pSheet->getTitle();
// echo 'Passed sheet name is '.$pSheetName.PHP_EOL;
// echo 'Range reference is '.$pRange.PHP_EOL;
if (strpos ($pRange, '!') !== false) {
// echo '$pRange reference includes sheet reference',PHP_EOL;
list($pSheetName,$pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
// echo 'New sheet name is '.$pSheetName,PHP_EOL;
// echo 'Adjusted Range reference is '.$pRange,PHP_EOL;
$pSheet = $this->_workbook->getSheetByName($pSheetName);
}
// Extract range
$aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
$pRange = $pSheetName.'!'.$pRange;
if (!isset($aReferences[1])) {
// Single cell in range
sscanf($aReferences[0],'%[A-Z]%d', $currentCol, $currentRow);
$cellValue = NULL;
if ($pSheet->cellExists($aReferences[0])) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
} else {
$returnValue[$currentRow][$currentCol] = NULL;
}
} else {
// Extract cell data for all cells in the range
foreach ($aReferences as $reference) {
// Extract range
sscanf($reference,'%[A-Z]%d', $currentCol, $currentRow);
$cellValue = NULL;
if ($pSheet->cellExists($reference)) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
} else {
$returnValue[$currentRow][$currentCol] = NULL;
}
}
}
}
// Return
return $returnValue;
} // function extractCellRange()
/**
* Extract range values
*
* @param string &$pRange String based range representation
* @param PHPExcel_Worksheet $pSheet Worksheet
* @return mixed Array of values in range if range contains more than one element. Otherwise, a single value is returned.
* @param boolean $resetLog Flag indicating whether calculation log should be reset or not
* @throws PHPExcel_Calculation_Exception
*/
public function extractNamedRange(&$pRange = 'A1', PHPExcel_Worksheet $pSheet = NULL, $resetLog = TRUE) {
// Return value
$returnValue = array ();
// echo 'extractNamedRange('.$pRange.')<br />';
if ($pSheet !== NULL) {
$pSheetName = $pSheet->getTitle();
// echo 'Current sheet name is '.$pSheetName.'<br />';
// echo 'Range reference is '.$pRange.'<br />';
if (strpos ($pRange, '!') !== false) {
// echo '$pRange reference includes sheet reference',PHP_EOL;
list($pSheetName,$pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
// echo 'New sheet name is '.$pSheetName,PHP_EOL;
// echo 'Adjusted Range reference is '.$pRange,PHP_EOL;
$pSheet = $this->_workbook->getSheetByName($pSheetName);
}
// Named range?
$namedRange = PHPExcel_NamedRange::resolveRange($pRange, $pSheet);
if ($namedRange !== NULL) {
$pSheet = $namedRange->getWorksheet();
// echo 'Named Range '.$pRange.' (';
$pRange = $namedRange->getRange();
$splitRange = PHPExcel_Cell::splitRange($pRange);
// Convert row and column references
if (ctype_alpha($splitRange[0][0])) {
$pRange = $splitRange[0][0] . '1:' . $splitRange[0][1] . $namedRange->getWorksheet()->getHighestRow();
} elseif(ctype_digit($splitRange[0][0])) {
$pRange = 'A' . $splitRange[0][0] . ':' . $namedRange->getWorksheet()->getHighestColumn() . $splitRange[0][1];
}
// echo $pRange.') is in sheet '.$namedRange->getWorksheet()->getTitle().'<br />';
// if ($pSheet->getTitle() != $namedRange->getWorksheet()->getTitle()) {
// if (!$namedRange->getLocalOnly()) {
// $pSheet = $namedRange->getWorksheet();
// } else {
// return $returnValue;
// }
// }
} else {
return PHPExcel_Calculation_Functions::REF();
}
// Extract range
$aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($pRange);
// var_dump($aReferences);
if (!isset($aReferences[1])) {
// Single cell (or single column or row) in range
list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($aReferences[0]);
$cellValue = NULL;
if ($pSheet->cellExists($aReferences[0])) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($aReferences[0])->getCalculatedValue($resetLog);
} else {
$returnValue[$currentRow][$currentCol] = NULL;
}
} else {
// Extract cell data for all cells in the range
foreach ($aReferences as $reference) {
// Extract range
list($currentCol,$currentRow) = PHPExcel_Cell::coordinateFromString($reference);
// echo 'NAMED RANGE: $currentCol='.$currentCol.' $currentRow='.$currentRow.'<br />';
$cellValue = NULL;
if ($pSheet->cellExists($reference)) {
$returnValue[$currentRow][$currentCol] = $pSheet->getCell($reference)->getCalculatedValue($resetLog);
} else {
$returnValue[$currentRow][$currentCol] = NULL;
}
}
}
// print_r($returnValue);
// echo '<br />';
}
// Return
return $returnValue;
} // function extractNamedRange()
/**
* Is a specific function implemented?
*
* @param string $pFunction Function Name
* @return boolean
*/
public function isImplemented($pFunction = '') {
$pFunction = strtoupper ($pFunction);
if (isset(self::$_PHPExcelFunctions[$pFunction])) {
return (self::$_PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY');
} else {
return FALSE;
}
} // function isImplemented()
/**
* Get a list of all implemented functions as an array of function objects
*
* @return array of PHPExcel_Calculation_Function
*/
public function listFunctions() {
// Return value
$returnValue = array();
// Loop functions
foreach(self::$_PHPExcelFunctions as $functionName => $function) {
if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
$returnValue[$functionName] = new PHPExcel_Calculation_Function($function['category'],
$functionName,
$function['functionCall']
);
}
}
// Return
return $returnValue;
} // function listFunctions()
/**
* Get a list of all Excel function names
*
* @return array
*/
public function listAllFunctionNames() {
return array_keys(self::$_PHPExcelFunctions);
} // function listAllFunctionNames()
/**
* Get a list of implemented Excel function names
*
* @return array
*/
public function listFunctionNames() {
// Return value
$returnValue = array();
// Loop functions
foreach(self::$_PHPExcelFunctions as $functionName => $function) {
if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
$returnValue[] = $functionName;
}
}
// Return
return $returnValue;
} // function listFunctionNames()
} // class PHPExcel_Calculation
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) { private function _executeNumericBinaryOperation($cellID,$operand1,$operand2,$operation,$matrixFunction,&$stack) {
// Validate the two operands // Validate the two operands

View File

@ -21,20 +21,6 @@
* *
* @category PHPExcel * @category PHPExcel
* @package PHPExcel_Shared * @package PHPExcel_Shared
<<<<<<< HEAD
=======
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Shared_Date
*
* @category PHPExcel
* @package PHPExcel_Shared
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
@ -52,7 +38,6 @@ class PHPExcel_Shared_Date
* @public * @public
* @var string[] * @var string[]
*/ */
<<<<<<< HEAD
public static $monthNames = array( public static $monthNames = array(
'Jan' => 'January', 'Jan' => 'January',
'Feb' => 'February', 'Feb' => 'February',
@ -67,21 +52,6 @@ class PHPExcel_Shared_Date
'Nov' => 'November', 'Nov' => 'November',
'Dec' => 'December', 'Dec' => 'December',
); );
=======
public static $_monthNames = array( 'Jan' => 'January',
'Feb' => 'February',
'Mar' => 'March',
'Apr' => 'April',
'May' => 'May',
'Jun' => 'June',
'Jul' => 'July',
'Aug' => 'August',
'Sep' => 'September',
'Oct' => 'October',
'Nov' => 'November',
'Dec' => 'December',
);
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/* /*
* Names of the months of the year, indexed by shortname * Names of the months of the year, indexed by shortname
@ -90,20 +60,12 @@ class PHPExcel_Shared_Date
* @public * @public
* @var string[] * @var string[]
*/ */
<<<<<<< HEAD
public static $numberSuffixes = array( public static $numberSuffixes = array(
'st', 'st',
'nd', 'nd',
'rd', 'rd',
'th', 'th',
); );
=======
public static $_numberSuffixes = array( 'st',
'nd',
'rd',
'th',
);
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/* /*
* Base calendar year to use for calculations * Base calendar year to use for calculations
@ -111,11 +73,7 @@ class PHPExcel_Shared_Date
* @private * @private
* @var int * @var int
*/ */
<<<<<<< HEAD
protected static $excelBaseDate = self::CALENDAR_WINDOWS_1900; protected static $excelBaseDate = self::CALENDAR_WINDOWS_1900;
=======
protected static $_excelBaseDate = self::CALENDAR_WINDOWS_1900;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
* Set the Excel calendar (Windows 1900 or Mac 1904) * Set the Excel calendar (Windows 1900 or Mac 1904)
@ -123,7 +81,6 @@ class PHPExcel_Shared_Date
* @param integer $baseDate Excel base date (1900 or 1904) * @param integer $baseDate Excel base date (1900 or 1904)
* @return boolean Success or failure * @return boolean Success or failure
*/ */
<<<<<<< HEAD
public static function setExcelCalendar($baseDate) public static function setExcelCalendar($baseDate)
{ {
if (($baseDate == self::CALENDAR_WINDOWS_1900) || if (($baseDate == self::CALENDAR_WINDOWS_1900) ||
@ -133,16 +90,6 @@ class PHPExcel_Shared_Date
} }
return false; return false;
} }
=======
public static function setExcelCalendar($baseDate) {
if (($baseDate == self::CALENDAR_WINDOWS_1900) ||
($baseDate == self::CALENDAR_MAC_1904)) {
self::$_excelBaseDate = $baseDate;
return TRUE;
}
return FALSE;
} // function setExcelCalendar()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -150,16 +97,10 @@ class PHPExcel_Shared_Date
* *
* @return integer Excel base date (1900 or 1904) * @return integer Excel base date (1900 or 1904)
*/ */
<<<<<<< HEAD
public static function getExcelCalendar() public static function getExcelCalendar()
{ {
return self::$excelBaseDate; return self::$excelBaseDate;
} }
=======
public static function getExcelCalendar() {
return self::$_excelBaseDate;
} // function getExcelCalendar()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -171,7 +112,6 @@ class PHPExcel_Shared_Date
* @param string $timezone The timezone for finding the adjustment from UST * @param string $timezone The timezone for finding the adjustment from UST
* @return long PHP serialized date/time * @return long PHP serialized date/time
*/ */
<<<<<<< HEAD
public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = false, $timezone = null) public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = false, $timezone = null)
{ {
if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) { if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) {
@ -182,26 +122,11 @@ class PHPExcel_Shared_Date
} }
} else { } else {
$myexcelBaseDate = 24107; $myexcelBaseDate = 24107;
=======
public static function ExcelToPHP($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) {
if (self::$_excelBaseDate == self::CALENDAR_WINDOWS_1900) {
$my_excelBaseDate = 25569;
// Adjust for the spurious 29-Feb-1900 (Day 60)
if ($dateValue < 60) {
--$my_excelBaseDate;
}
} else {
$my_excelBaseDate = 24107;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
} }
// Perform conversion // Perform conversion
if ($dateValue >= 1) { if ($dateValue >= 1) {
<<<<<<< HEAD
$utcDays = $dateValue - $myexcelBaseDate; $utcDays = $dateValue - $myexcelBaseDate;
=======
$utcDays = $dateValue - $my_excelBaseDate;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
$returnValue = round($utcDays * 86400); $returnValue = round($utcDays * 86400);
if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) { if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {
$returnValue = (integer) $returnValue; $returnValue = (integer) $returnValue;
@ -217,14 +142,8 @@ class PHPExcel_Shared_Date
PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) : PHPExcel_Shared_TimeZone::getTimezoneAdjustment($timezone, $returnValue) :
0; 0;
<<<<<<< HEAD
return $returnValue + $timezoneAdjustment; return $returnValue + $timezoneAdjustment;
} }
=======
// Return
return $returnValue + $timezoneAdjustment;
} // function ExcelToPHP()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -233,12 +152,8 @@ class PHPExcel_Shared_Date
* @param integer $dateValue Excel date/time value * @param integer $dateValue Excel date/time value
* @return DateTime PHP date/time object * @return DateTime PHP date/time object
*/ */
<<<<<<< HEAD
public static function ExcelToPHPObject($dateValue = 0) public static function ExcelToPHPObject($dateValue = 0)
{ {
=======
public static function ExcelToPHPObject($dateValue = 0) {
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
$dateTime = self::ExcelToPHP($dateValue); $dateTime = self::ExcelToPHP($dateValue);
$days = floor($dateTime / 86400); $days = floor($dateTime / 86400);
$time = round((($dateTime / 86400) - $days) * 86400); $time = round((($dateTime / 86400) - $days) * 86400);
@ -250,11 +165,7 @@ class PHPExcel_Shared_Date
$dateObj->setTime($hours,$minutes,$seconds); $dateObj->setTime($hours,$minutes,$seconds);
return $dateObj; return $dateObj;
<<<<<<< HEAD
} }
=======
} // function ExcelToPHPObject()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -267,18 +178,11 @@ class PHPExcel_Shared_Date
* @return mixed Excel date/time value * @return mixed Excel date/time value
* or boolean FALSE on failure * or boolean FALSE on failure
*/ */
<<<<<<< HEAD
public static function PHPToExcel($dateValue = 0, $adjustToTimezone = false, $timezone = null) public static function PHPToExcel($dateValue = 0, $adjustToTimezone = false, $timezone = null)
{ {
$saveTimeZone = date_default_timezone_get(); $saveTimeZone = date_default_timezone_get();
date_default_timezone_set('UTC'); date_default_timezone_set('UTC');
$retValue = false; $retValue = false;
=======
public static function PHPToExcel($dateValue = 0, $adjustToTimezone = FALSE, $timezone = NULL) {
$saveTimeZone = date_default_timezone_get();
date_default_timezone_set('UTC');
$retValue = FALSE;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) { if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
$retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'), $retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'),
$dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s') $dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s')
@ -291,11 +195,7 @@ class PHPExcel_Shared_Date
date_default_timezone_set($saveTimeZone); date_default_timezone_set($saveTimeZone);
return $retValue; return $retValue;
<<<<<<< HEAD
} }
=======
} // function PHPToExcel()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -309,19 +209,13 @@ class PHPExcel_Shared_Date
* @param long $seconds * @param long $seconds
* @return long Excel date/time value * @return long Excel date/time value
*/ */
<<<<<<< HEAD
public static function FormattedPHPToExcel($year, $month, $day, $hours = 0, $minutes = 0, $seconds = 0) public static function FormattedPHPToExcel($year, $month, $day, $hours = 0, $minutes = 0, $seconds = 0)
{ {
if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) { if (self::$excelBaseDate == self::CALENDAR_WINDOWS_1900) {
=======
public static function FormattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0) {
if (self::$_excelBaseDate == self::CALENDAR_WINDOWS_1900) {
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
// //
// Fudge factor for the erroneous fact that the year 1900 is treated as a Leap Year in MS Excel // Fudge factor for the erroneous fact that the year 1900 is treated as a Leap Year in MS Excel
// This affects every date following 28th February 1900 // This affects every date following 28th February 1900
// //
<<<<<<< HEAD
$excel1900isLeapYear = true; $excel1900isLeapYear = true;
if (($year == 1900) && ($month <= 2)) { if (($year == 1900) && ($month <= 2)) {
$excel1900isLeapYear = false; $excel1900isLeapYear = false;
@ -330,14 +224,6 @@ class PHPExcel_Shared_Date
} else { } else {
$myexcelBaseDate = 2416481; $myexcelBaseDate = 2416481;
$excel1900isLeapYear = false; $excel1900isLeapYear = false;
=======
$excel1900isLeapYear = TRUE;
if (($year == 1900) && ($month <= 2)) { $excel1900isLeapYear = FALSE; }
$my_excelBaseDate = 2415020;
} else {
$my_excelBaseDate = 2416481;
$excel1900isLeapYear = FALSE;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
} }
// Julian base date Adjustment // Julian base date Adjustment
@ -351,20 +237,12 @@ class PHPExcel_Shared_Date
// Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0) // Calculate the Julian Date, then subtract the Excel base date (JD 2415020 = 31-Dec-1899 Giving Excel Date of 0)
$century = substr($year,0,2); $century = substr($year,0,2);
$decade = substr($year,2,2); $decade = substr($year,2,2);
<<<<<<< HEAD
$excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myexcelBaseDate + $excel1900isLeapYear; $excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $myexcelBaseDate + $excel1900isLeapYear;
=======
$excelDate = floor((146097 * $century) / 4) + floor((1461 * $decade) / 4) + floor((153 * $month + 2) / 5) + $day + 1721119 - $my_excelBaseDate + $excel1900isLeapYear;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
$excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400; $excelTime = (($hours * 3600) + ($minutes * 60) + $seconds) / 86400;
return (float) $excelDate + $excelTime; return (float) $excelDate + $excelTime;
<<<<<<< HEAD
} }
=======
} // function FormattedPHPToExcel()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -373,22 +251,14 @@ class PHPExcel_Shared_Date
* @param PHPExcel_Cell $pCell * @param PHPExcel_Cell $pCell
* @return boolean * @return boolean
*/ */
<<<<<<< HEAD
public static function isDateTime(PHPExcel_Cell $pCell) public static function isDateTime(PHPExcel_Cell $pCell)
{ {
=======
public static function isDateTime(PHPExcel_Cell $pCell) {
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
return self::isDateTimeFormat( return self::isDateTimeFormat(
$pCell->getWorksheet()->getStyle( $pCell->getWorksheet()->getStyle(
$pCell->getCoordinate() $pCell->getCoordinate()
)->getNumberFormat() )->getNumberFormat()
); );
<<<<<<< HEAD
} }
=======
} // function isDateTime()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -397,16 +267,10 @@ class PHPExcel_Shared_Date
* @param PHPExcel_Style_NumberFormat $pFormat * @param PHPExcel_Style_NumberFormat $pFormat
* @return boolean * @return boolean
*/ */
<<<<<<< HEAD
public static function isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat) public static function isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat)
{ {
return self::isDateTimeFormatCode($pFormat->getFormatCode()); return self::isDateTimeFormatCode($pFormat->getFormatCode());
} }
=======
public static function isDateTimeFormat(PHPExcel_Style_NumberFormat $pFormat) {
return self::isDateTimeFormatCode($pFormat->getFormatCode());
} // function isDateTimeFormat()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
private static $possibleDateFormatCharacters = 'eymdHs'; private static $possibleDateFormatCharacters = 'eymdHs';
@ -417,7 +281,6 @@ class PHPExcel_Shared_Date
* @param string $pFormatCode * @param string $pFormatCode
* @return boolean * @return boolean
*/ */
<<<<<<< HEAD
public static function isDateTimeFormatCode($pFormatCode = '') public static function isDateTimeFormatCode($pFormatCode = '')
{ {
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL)) if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL))
@ -426,15 +289,6 @@ class PHPExcel_Shared_Date
if (preg_match('/[0#]E[+-]0/i', $pFormatCode)) if (preg_match('/[0#]E[+-]0/i', $pFormatCode))
// Scientific format // Scientific format
return false; return false;
=======
public static function isDateTimeFormatCode($pFormatCode = '') {
if (strtolower($pFormatCode) === strtolower(PHPExcel_Style_NumberFormat::FORMAT_GENERAL))
// "General" contains an epoch letter 'e', so we trap for it explicitly here (case-insensitive check)
return FALSE;
if (preg_match('/[0#]E[+-]0/i', $pFormatCode))
// Scientific format
return FALSE;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
// Switch on formatcode // Switch on formatcode
switch ($pFormatCode) { switch ($pFormatCode) {
// Explicitly defined date formats // Explicitly defined date formats
@ -460,7 +314,6 @@ class PHPExcel_Shared_Date
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX16: case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX16:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17: case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX17:
case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX22: case PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX22:
<<<<<<< HEAD
return true; return true;
} }
@ -489,36 +342,6 @@ class PHPExcel_Shared_Date
// No date... // No date...
return false; return false;
} }
=======
return TRUE;
}
// Typically number, currency or accounting (or occasionally fraction) formats
if ((substr($pFormatCode,0,1) == '_') || (substr($pFormatCode,0,2) == '0 ')) {
return FALSE;
}
// Try checking for any of the date formatting characters that don't appear within square braces
if (preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$pFormatCode)) {
// We might also have a format mask containing quoted strings...
// we don't want to test for any of our characters within the quoted blocks
if (strpos($pFormatCode,'"') !== FALSE) {
$segMatcher = FALSE;
foreach(explode('"',$pFormatCode) as $subVal) {
// Only test in alternate array entries (the non-quoted blocks)
if (($segMatcher = !$segMatcher) &&
(preg_match('/(^|\])[^\[]*['.self::$possibleDateFormatCharacters.']/i',$subVal))) {
return TRUE;
}
}
return FALSE;
}
return TRUE;
}
// No date...
return FALSE;
} // function isDateTimeFormatCode()
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -527,25 +350,16 @@ class PHPExcel_Shared_Date
* @param string $dateValue Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10' * @param string $dateValue Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10'
* @return float|FALSE Excel date/time serial value * @return float|FALSE Excel date/time serial value
*/ */
<<<<<<< HEAD
public static function stringToExcel($dateValue = '') public static function stringToExcel($dateValue = '')
{ {
if (strlen($dateValue) < 2) if (strlen($dateValue) < 2)
return false; return false;
if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue)) if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue))
return false; return false;
=======
public static function stringToExcel($dateValue = '') {
if (strlen($dateValue) < 2)
return FALSE;
if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue))
return FALSE;
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
$dateValueNew = PHPExcel_Calculation_DateTime::DATEVALUE($dateValue); $dateValueNew = PHPExcel_Calculation_DateTime::DATEVALUE($dateValue);
if ($dateValueNew === PHPExcel_Calculation_Functions::VALUE()) { if ($dateValueNew === PHPExcel_Calculation_Functions::VALUE()) {
<<<<<<< HEAD
return false; return false;
} }
@ -561,24 +375,6 @@ class PHPExcel_Shared_Date
public static function monthStringToNumber($month) public static function monthStringToNumber($month)
{ {
=======
return FALSE;
} else {
if (strpos($dateValue, ':') !== FALSE) {
$timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($dateValue);
if ($timeValue === PHPExcel_Calculation_Functions::VALUE()) {
return FALSE;
}
$dateValueNew += $timeValue;
}
return $dateValueNew;
}
}
public static function monthStringToNumber($month) {
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
$monthIndex = 1; $monthIndex = 1;
foreach(self::$monthNames as $shortMonthName => $longMonthName) { foreach(self::$monthNames as $shortMonthName => $longMonthName) {
if (($month === $longMonthName) || ($month === $shortMonthName)) { if (($month === $longMonthName) || ($month === $shortMonthName)) {
@ -589,14 +385,9 @@ class PHPExcel_Shared_Date
return $month; return $month;
} }
<<<<<<< HEAD
public static function dayStringToNumber($day) public static function dayStringToNumber($day)
{ {
$strippedDayValue = (str_replace(self::$numberSuffixes, '', $day)); $strippedDayValue = (str_replace(self::$numberSuffixes, '', $day));
=======
public static function dayStringToNumber($day) {
$strippedDayValue = (str_replace(self::$_numberSuffixes,'',$day));
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
if (is_numeric($strippedDayValue)) { if (is_numeric($strippedDayValue)) {
return $strippedDayValue; return $strippedDayValue;
} }

View File

@ -30,34 +30,12 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PCLZip/pclzip.lib.php';
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE## * @version ##VERSION##, ##DATE##
*/ */
<<<<<<< HEAD
=======
if (!defined('PCLZIP_TEMPORARY_DIR')) {
define('PCLZIP_TEMPORARY_DIR', PHPExcel_Shared_File::sys_get_temp_dir() . DIRECTORY_SEPARATOR);
}
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PCLZip/pclzip.lib.php';
/**
* PHPExcel_Shared_ZipArchive
*
* @category PHPExcel
* @package PHPExcel_Shared_ZipArchive
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
class PHPExcel_Shared_ZipArchive class PHPExcel_Shared_ZipArchive
{ {
/** constants */ /** constants */
<<<<<<< HEAD
const OVERWRITE = 'OVERWRITE'; const OVERWRITE = 'OVERWRITE';
const CREATE = 'CREATE'; const CREATE = 'CREATE';
=======
const OVERWRITE = 'OVERWRITE';
const CREATE = 'CREATE';
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
/** /**
@ -114,14 +92,10 @@ class PHPExcel_Shared_ZipArchive
fwrite($handle, $contents); fwrite($handle, $contents);
fclose($handle); fclose($handle);
<<<<<<< HEAD
$res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"], $res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"],
PCLZIP_OPT_REMOVE_PATH, $this->_tempDir, PCLZIP_OPT_REMOVE_PATH, $this->_tempDir,
PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"] PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]
); );
=======
$res = $this->_zip->add($this->_tempDir.'/'.$filenameParts["basename"], PCLZIP_OPT_REMOVE_PATH, $this->_tempDir, PCLZIP_OPT_ADD_PATH, $filenameParts["dirname"]);
>>>>>>> f37630e938da2f1dbe9f16a20fdfbf701403812b
if ($res == 0) { if ($res == 0) {
throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->_zip->errorInfo(true)); throw new PHPExcel_Writer_Exception("Error zipping files : " . $this->_zip->errorInfo(true));
} }

View File

@ -136,7 +136,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* @param string $data binary data to append * @param string $data binary data to append
* @access private * @access private
*/ */
private function _append($data) public function _append($data)
{ {
if (strlen($data) - 4 > $this->_limit) { if (strlen($data) - 4 > $this->_limit) {
$data = $this->_addContinue($data); $data = $this->_addContinue($data);
@ -169,7 +169,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* 0x0010 Worksheet. * 0x0010 Worksheet.
* @access private * @access private
*/ */
private function _storeBof($type) public function _storeBof($type)
{ {
$record = 0x0809; // Record identifier (BIFF5-BIFF8) $record = 0x0809; // Record identifier (BIFF5-BIFF8)
$length = 0x0010; $length = 0x0010;
@ -192,7 +192,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* *
* @access private * @access private
*/ */
private function _storeEof() public function _storeEof()
{ {
$record = 0x000A; // Record identifier $record = 0x000A; // Record identifier
$length = 0x0000; // Number of bytes to follow $length = 0x0000; // Number of bytes to follow
@ -226,7 +226,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* @return string A very convenient string of continue blocks * @return string A very convenient string of continue blocks
* @access private * @access private
*/ */
private function _addContinue($data) public function _addContinue($data)
{ {
$limit = $this->_limit; $limit = $this->_limit;
$record = 0x003C; // Record identifier $record = 0x003C; // Record identifier

View File

@ -1266,7 +1266,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$record = 0x0200; // Record identifier $record = 0x0200; // Record identifier
$length = 0x000E; $length = 0x000E;
$data = pack('VVvvv', $this->_firstRowIndex, $this->_lastRowIndex + 1, $this->_firstColumnIndex, $this->_lastColumnIndex + 1, 0x0000 // reserved); $data = pack('VVvvv', $this->_firstRowIndex, $this->_lastRowIndex + 1, $this->_firstColumnIndex, $this->_lastColumnIndex + 1, 0x0000); // reserved
$header = pack("vv", $record, $length); $header = pack("vv", $record, $length);
$this->_append($header.$data); $this->_append($header.$data);