TextData.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. if (!defined('PHPEXCEL_ROOT')) {
  8. /**
  9. * @ignore
  10. */
  11. define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
  12. require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
  13. }
  14. /**
  15. * PHPExcel_Calculation_TextData
  16. *
  17. * Copyright (c) 2006 - 2015 PHPExcel
  18. *
  19. * This library is free software; you can redistribute it and/or
  20. * modify it under the terms of the GNU Lesser General Public
  21. * License as published by the Free Software Foundation; either
  22. * version 2.1 of the License, or (at your option) any later version.
  23. *
  24. * This library is distributed in the hope that it will be useful,
  25. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  27. * Lesser General Public License for more details.
  28. *
  29. * You should have received a copy of the GNU Lesser General Public
  30. * License along with this library; if not, write to the Free Software
  31. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  32. *
  33. * @category PHPExcel
  34. * @package PHPExcel_Calculation
  35. * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  36. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
  37. * @version ##VERSION##, ##DATE##
  38. */
  39. class PHPExcel_Calculation_TextData
  40. {
  41. private static $invalidChars;
  42. private static function unicodeToOrd($c)
  43. {
  44. if (ord($c{0}) >=0 && ord($c{0}) <= 127) {
  45. return ord($c{0});
  46. } elseif (ord($c{0}) >= 192 && ord($c{0}) <= 223) {
  47. return (ord($c{0})-192)*64 + (ord($c{1})-128);
  48. } elseif (ord($c{0}) >= 224 && ord($c{0}) <= 239) {
  49. return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128);
  50. } elseif (ord($c{0}) >= 240 && ord($c{0}) <= 247) {
  51. return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128);
  52. } elseif (ord($c{0}) >= 248 && ord($c{0}) <= 251) {
  53. return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128);
  54. } elseif (ord($c{0}) >= 252 && ord($c{0}) <= 253) {
  55. return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128);
  56. } elseif (ord($c{0}) >= 254 && ord($c{0}) <= 255) {
  57. // error
  58. return PHPExcel_Calculation_Functions::VALUE();
  59. }
  60. return 0;
  61. }
  62. /**
  63. * CHARACTER
  64. *
  65. * @param string $character Value
  66. * @return int
  67. */
  68. public static function CHARACTER($character)
  69. {
  70. $character = PHPExcel_Calculation_Functions::flattenSingleValue($character);
  71. if ((!is_numeric($character)) || ($character < 0)) {
  72. return PHPExcel_Calculation_Functions::VALUE();
  73. }
  74. if (function_exists('mb_convert_encoding')) {
  75. return mb_convert_encoding('&#'.intval($character).';', 'UTF-8', 'HTML-ENTITIES');
  76. } else {
  77. return chr(intval($character));
  78. }
  79. }
  80. /**
  81. * TRIMNONPRINTABLE
  82. *
  83. * @param mixed $stringValue Value to check
  84. * @return string
  85. */
  86. public static function TRIMNONPRINTABLE($stringValue = '')
  87. {
  88. $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
  89. if (is_bool($stringValue)) {
  90. return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  91. }
  92. if (self::$invalidChars == null) {
  93. self::$invalidChars = range(chr(0), chr(31));
  94. }
  95. if (is_string($stringValue) || is_numeric($stringValue)) {
  96. return str_replace(self::$invalidChars, '', trim($stringValue, "\x00..\x1F"));
  97. }
  98. return null;
  99. }
  100. /**
  101. * TRIMSPACES
  102. *
  103. * @param mixed $stringValue Value to check
  104. * @return string
  105. */
  106. public static function TRIMSPACES($stringValue = '')
  107. {
  108. $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
  109. if (is_bool($stringValue)) {
  110. return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  111. }
  112. if (is_string($stringValue) || is_numeric($stringValue)) {
  113. return trim(preg_replace('/ +/', ' ', trim($stringValue, ' ')), ' ');
  114. }
  115. return null;
  116. }
  117. /**
  118. * ASCIICODE
  119. *
  120. * @param string $characters Value
  121. * @return int
  122. */
  123. public static function ASCIICODE($characters)
  124. {
  125. if (($characters === null) || ($characters === '')) {
  126. return PHPExcel_Calculation_Functions::VALUE();
  127. }
  128. $characters = PHPExcel_Calculation_Functions::flattenSingleValue($characters);
  129. if (is_bool($characters)) {
  130. if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
  131. $characters = (int) $characters;
  132. } else {
  133. $characters = ($characters) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  134. }
  135. }
  136. $character = $characters;
  137. if ((function_exists('mb_strlen')) && (function_exists('mb_substr'))) {
  138. if (mb_strlen($characters, 'UTF-8') > 1) {
  139. $character = mb_substr($characters, 0, 1, 'UTF-8');
  140. }
  141. return self::unicodeToOrd($character);
  142. } else {
  143. if (strlen($characters) > 0) {
  144. $character = substr($characters, 0, 1);
  145. }
  146. return ord($character);
  147. }
  148. }
  149. /**
  150. * CONCATENATE
  151. *
  152. * @return string
  153. */
  154. public static function CONCATENATE()
  155. {
  156. $returnValue = '';
  157. // Loop through arguments
  158. $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
  159. foreach ($aArgs as $arg) {
  160. if (is_bool($arg)) {
  161. if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
  162. $arg = (int) $arg;
  163. } else {
  164. $arg = ($arg) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  165. }
  166. }
  167. $returnValue .= $arg;
  168. }
  169. return $returnValue;
  170. }
  171. /**
  172. * DOLLAR
  173. *
  174. * This function converts a number to text using currency format, with the decimals rounded to the specified place.
  175. * The format used is $#,##0.00_);($#,##0.00)..
  176. *
  177. * @param float $value The value to format
  178. * @param int $decimals The number of digits to display to the right of the decimal point.
  179. * If decimals is negative, number is rounded to the left of the decimal point.
  180. * If you omit decimals, it is assumed to be 2
  181. * @return string
  182. */
  183. public static function DOLLAR($value = 0, $decimals = 2)
  184. {
  185. $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
  186. $decimals = is_null($decimals) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
  187. // Validate parameters
  188. if (!is_numeric($value) || !is_numeric($decimals)) {
  189. return PHPExcel_Calculation_Functions::NaN();
  190. }
  191. $decimals = floor($decimals);
  192. $mask = '$#,##0';
  193. if ($decimals > 0) {
  194. $mask .= '.' . str_repeat('0', $decimals);
  195. } else {
  196. $round = pow(10, abs($decimals));
  197. if ($value < 0) {
  198. $round = 0-$round;
  199. }
  200. $value = PHPExcel_Calculation_MathTrig::MROUND($value, $round);
  201. }
  202. return PHPExcel_Style_NumberFormat::toFormattedString($value, $mask);
  203. }
  204. /**
  205. * SEARCHSENSITIVE
  206. *
  207. * @param string $needle The string to look for
  208. * @param string $haystack The string in which to look
  209. * @param int $offset Offset within $haystack
  210. * @return string
  211. */
  212. public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1)
  213. {
  214. $needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
  215. $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
  216. $offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
  217. if (!is_bool($needle)) {
  218. if (is_bool($haystack)) {
  219. $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  220. }
  221. if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) {
  222. if (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
  223. return $offset;
  224. }
  225. if (function_exists('mb_strpos')) {
  226. $pos = mb_strpos($haystack, $needle, --$offset, 'UTF-8');
  227. } else {
  228. $pos = strpos($haystack, $needle, --$offset);
  229. }
  230. if ($pos !== false) {
  231. return ++$pos;
  232. }
  233. }
  234. }
  235. return PHPExcel_Calculation_Functions::VALUE();
  236. }
  237. /**
  238. * SEARCHINSENSITIVE
  239. *
  240. * @param string $needle The string to look for
  241. * @param string $haystack The string in which to look
  242. * @param int $offset Offset within $haystack
  243. * @return string
  244. */
  245. public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1)
  246. {
  247. $needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
  248. $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
  249. $offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
  250. if (!is_bool($needle)) {
  251. if (is_bool($haystack)) {
  252. $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  253. }
  254. if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) {
  255. if (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
  256. return $offset;
  257. }
  258. if (function_exists('mb_stripos')) {
  259. $pos = mb_stripos($haystack, $needle, --$offset, 'UTF-8');
  260. } else {
  261. $pos = stripos($haystack, $needle, --$offset);
  262. }
  263. if ($pos !== false) {
  264. return ++$pos;
  265. }
  266. }
  267. }
  268. return PHPExcel_Calculation_Functions::VALUE();
  269. }
  270. /**
  271. * FIXEDFORMAT
  272. *
  273. * @param mixed $value Value to check
  274. * @param integer $decimals
  275. * @param boolean $no_commas
  276. * @return boolean
  277. */
  278. public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = false)
  279. {
  280. $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
  281. $decimals = PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
  282. $no_commas = PHPExcel_Calculation_Functions::flattenSingleValue($no_commas);
  283. // Validate parameters
  284. if (!is_numeric($value) || !is_numeric($decimals)) {
  285. return PHPExcel_Calculation_Functions::NaN();
  286. }
  287. $decimals = floor($decimals);
  288. $valueResult = round($value, $decimals);
  289. if ($decimals < 0) {
  290. $decimals = 0;
  291. }
  292. if (!$no_commas) {
  293. $valueResult = number_format($valueResult, $decimals);
  294. }
  295. return (string) $valueResult;
  296. }
  297. /**
  298. * LEFT
  299. *
  300. * @param string $value Value
  301. * @param int $chars Number of characters
  302. * @return string
  303. */
  304. public static function LEFT($value = '', $chars = 1)
  305. {
  306. $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
  307. $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
  308. if ($chars < 0) {
  309. return PHPExcel_Calculation_Functions::VALUE();
  310. }
  311. if (is_bool($value)) {
  312. $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  313. }
  314. if (function_exists('mb_substr')) {
  315. return mb_substr($value, 0, $chars, 'UTF-8');
  316. } else {
  317. return substr($value, 0, $chars);
  318. }
  319. }
  320. /**
  321. * MID
  322. *
  323. * @param string $value Value
  324. * @param int $start Start character
  325. * @param int $chars Number of characters
  326. * @return string
  327. */
  328. public static function MID($value = '', $start = 1, $chars = null)
  329. {
  330. $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
  331. $start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
  332. $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
  333. if (($start < 1) || ($chars < 0)) {
  334. return PHPExcel_Calculation_Functions::VALUE();
  335. }
  336. if (is_bool($value)) {
  337. $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  338. }
  339. if (function_exists('mb_substr')) {
  340. return mb_substr($value, --$start, $chars, 'UTF-8');
  341. } else {
  342. return substr($value, --$start, $chars);
  343. }
  344. }
  345. /**
  346. * RIGHT
  347. *
  348. * @param string $value Value
  349. * @param int $chars Number of characters
  350. * @return string
  351. */
  352. public static function RIGHT($value = '', $chars = 1)
  353. {
  354. $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
  355. $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
  356. if ($chars < 0) {
  357. return PHPExcel_Calculation_Functions::VALUE();
  358. }
  359. if (is_bool($value)) {
  360. $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  361. }
  362. if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) {
  363. return mb_substr($value, mb_strlen($value, 'UTF-8') - $chars, $chars, 'UTF-8');
  364. } else {
  365. return substr($value, strlen($value) - $chars);
  366. }
  367. }
  368. /**
  369. * STRINGLENGTH
  370. *
  371. * @param string $value Value
  372. * @return string
  373. */
  374. public static function STRINGLENGTH($value = '')
  375. {
  376. $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
  377. if (is_bool($value)) {
  378. $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  379. }
  380. if (function_exists('mb_strlen')) {
  381. return mb_strlen($value, 'UTF-8');
  382. } else {
  383. return strlen($value);
  384. }
  385. }
  386. /**
  387. * LOWERCASE
  388. *
  389. * Converts a string value to upper case.
  390. *
  391. * @param string $mixedCaseString
  392. * @return string
  393. */
  394. public static function LOWERCASE($mixedCaseString)
  395. {
  396. $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
  397. if (is_bool($mixedCaseString)) {
  398. $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  399. }
  400. return PHPExcel_Shared_String::StrToLower($mixedCaseString);
  401. }
  402. /**
  403. * UPPERCASE
  404. *
  405. * Converts a string value to upper case.
  406. *
  407. * @param string $mixedCaseString
  408. * @return string
  409. */
  410. public static function UPPERCASE($mixedCaseString)
  411. {
  412. $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
  413. if (is_bool($mixedCaseString)) {
  414. $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  415. }
  416. return PHPExcel_Shared_String::StrToUpper($mixedCaseString);
  417. }
  418. /**
  419. * PROPERCASE
  420. *
  421. * Converts a string value to upper case.
  422. *
  423. * @param string $mixedCaseString
  424. * @return string
  425. */
  426. public static function PROPERCASE($mixedCaseString)
  427. {
  428. $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
  429. if (is_bool($mixedCaseString)) {
  430. $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
  431. }
  432. return PHPExcel_Shared_String::StrToTitle($mixedCaseString);
  433. }
  434. /**
  435. * REPLACE
  436. *
  437. * @param string $oldText String to modify
  438. * @param int $start Start character
  439. * @param int $chars Number of characters
  440. * @param string $newText String to replace in defined position
  441. * @return string
  442. */
  443. public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText)
  444. {
  445. $oldText = PHPExcel_Calculation_Functions::flattenSingleValue($oldText);
  446. $start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
  447. $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
  448. $newText = PHPExcel_Calculation_Functions::flattenSingleValue($newText);
  449. $left = self::LEFT($oldText, $start-1);
  450. $right = self::RIGHT($oldText, self::STRINGLENGTH($oldText)-($start+$chars)+1);
  451. return $left.$newText.$right;
  452. }
  453. /**
  454. * SUBSTITUTE
  455. *
  456. * @param string $text Value
  457. * @param string $fromText From Value
  458. * @param string $toText To Value
  459. * @param integer $instance Instance Number
  460. * @return string
  461. */
  462. public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0)
  463. {
  464. $text = PHPExcel_Calculation_Functions::flattenSingleValue($text);
  465. $fromText = PHPExcel_Calculation_Functions::flattenSingleValue($fromText);
  466. $toText = PHPExcel_Calculation_Functions::flattenSingleValue($toText);
  467. $instance = floor(PHPExcel_Calculation_Functions::flattenSingleValue($instance));
  468. if ($instance == 0) {
  469. if (function_exists('mb_str_replace')) {
  470. return mb_str_replace($fromText, $toText, $text);
  471. } else {
  472. return str_replace($fromText, $toText, $text);
  473. }
  474. } else {
  475. $pos = -1;
  476. while ($instance > 0) {
  477. if (function_exists('mb_strpos')) {
  478. $pos = mb_strpos($text, $fromText, $pos+1, 'UTF-8');
  479. } else {
  480. $pos = strpos($text, $fromText, $pos+1);
  481. }
  482. if ($pos === false) {
  483. break;
  484. }
  485. --$instance;
  486. }
  487. if ($pos !== false) {
  488. if (function_exists('mb_strlen')) {
  489. return self::REPLACE($text, ++$pos, mb_strlen($fromText, 'UTF-8'), $toText);
  490. } else {
  491. return self::REPLACE($text, ++$pos, strlen($fromText), $toText);
  492. }
  493. }
  494. }
  495. return $text;
  496. }
  497. /**
  498. * RETURNSTRING
  499. *
  500. * @param mixed $testValue Value to check
  501. * @return boolean
  502. */
  503. public static function RETURNSTRING($testValue = '')
  504. {
  505. $testValue = PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
  506. if (is_string($testValue)) {
  507. return $testValue;
  508. }
  509. return null;
  510. }
  511. /**
  512. * TEXTFORMAT
  513. *
  514. * @param mixed $value Value to check
  515. * @param string $format Format mask to use
  516. * @return boolean
  517. */
  518. public static function TEXTFORMAT($value, $format)
  519. {
  520. $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
  521. $format = PHPExcel_Calculation_Functions::flattenSingleValue($format);
  522. if ((is_string($value)) && (!is_numeric($value)) && PHPExcel_Shared_Date::isDateTimeFormatCode($format)) {
  523. $value = PHPExcel_Calculation_DateTime::DATEVALUE($value);
  524. }
  525. return (string) PHPExcel_Style_NumberFormat::toFormattedString($value, $format);
  526. }
  527. /**
  528. * VALUE
  529. *
  530. * @param mixed $value Value to check
  531. * @return boolean
  532. */
  533. public static function VALUE($value = '')
  534. {
  535. $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
  536. if (!is_numeric($value)) {
  537. $numberValue = str_replace(
  538. PHPExcel_Shared_String::getThousandsSeparator(),
  539. '',
  540. trim($value, " \t\n\r\0\x0B" . PHPExcel_Shared_String::getCurrencyCode())
  541. );
  542. if (is_numeric($numberValue)) {
  543. return (float) $numberValue;
  544. }
  545. $dateSetting = PHPExcel_Calculation_Functions::getReturnDateType();
  546. PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
  547. if (strpos($value, ':') !== false) {
  548. $timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($value);
  549. if ($timeValue !== PHPExcel_Calculation_Functions::VALUE()) {
  550. PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
  551. return $timeValue;
  552. }
  553. }
  554. $dateValue = PHPExcel_Calculation_DateTime::DATEVALUE($value);
  555. if ($dateValue !== PHPExcel_Calculation_Functions::VALUE()) {
  556. PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
  557. return $dateValue;
  558. }
  559. PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
  560. return PHPExcel_Calculation_Functions::VALUE();
  561. }
  562. return (float) $value;
  563. }
  564. }