|
17 | 17 | /** |
18 | 18 | * A class for reading Microsoft Excel Spreadsheets. |
19 | 19 | * |
20 | | - * Originally developed by Vadim Tkachenko under the name PHPExcelReader. |
21 | | - * (http://sourceforge.net/projects/phpexcelreader) |
22 | | - * Based on the Java version by Andy Khan (http://www.andykhan.com). |
23 | | - * Maintained by David Sanders. Reads only Biff 7 and Biff 8 formats. |
24 | | - * |
25 | | - * SimpleXLS version 2016 build by sergey.shuchkin@gmail.com |
26 | | - * |
27 | | - * @category Spreadsheet |
28 | | - * @package SimpleXLS |
29 | | - * @author Vadim Tkachenko <vt@phpapache.com>, Sergey Shuchkin <sergey.shuchkin@gmail.com> |
30 | | - * @copyright 1997-2016 The PHP Group |
31 | | - * @license http://www.php.net/license/3_0.txt PHP License 3.0 |
32 | | - * @version Release: 0.9.1 |
33 | | - * @link |
34 | | - * @see OLE, Spreadsheet_Excel_Writer, SimpleXLSX |
| 20 | + * SimpleXLS version 2016-2020 packaged by Sergey Shuchkin <sergey.shuchkin@gmail.com> from |
| 21 | + * Spreadsheet_Excel_Reader class developed by Vadim Tkachenko <vt@phpapache.com> |
35 | 22 | */ |
36 | 23 | class SimpleXLS { |
37 | 24 | const BIFF8 = 0x600; |
@@ -71,11 +58,6 @@ class SimpleXLS { |
71 | 58 | const TYPE_NINETEENFOUR = 0x22; |
72 | 59 | const TYPE_MERGEDCELLS = 0xE5; |
73 | 60 |
|
74 | | - const UTCOFFSETDAYS = 25569; |
75 | | - const UTCOFFSETDAYS1904 = 24107; |
76 | | - const MSINADAY = 86400; |
77 | | - //const MSINADAY = 24 * 60 * 60; |
78 | | - |
79 | 61 | //const DEF_NUM_FORMAT = "%.2f"; |
80 | 62 | const DEF_NUM_FORMAT = '%s'; |
81 | 63 |
|
@@ -436,11 +418,7 @@ private function _oleread( $sFileName, $isData = false ) { |
436 | 418 |
|
437 | 419 | public function _GetInt4d( $data, $pos ) { |
438 | 420 | $value = ord( $data[ $pos ] ) | ( ord( $data[ $pos + 1 ] ) << 8 ) | ( ord( $data[ $pos + 2 ] ) << 16 ) | ( ord( $data[ $pos + 3 ] ) << 24 ); |
439 | | - if ( $value >= 4294967294 ) { |
440 | | - $value = - 2; |
441 | | - } |
442 | | - |
443 | | - return $value; |
| 421 | + return ($value > 0x7FFFFFFF) ? $value - 0x100000000 : $value; |
444 | 422 | } |
445 | 423 |
|
446 | 424 | // }}} |
@@ -1144,29 +1122,19 @@ public function isDate( $spos ) { |
1144 | 1122 | * Dates in Excel are stored as number of seconds from an epoch. On |
1145 | 1123 | * Windows, the epoch is 30/12/1899 and on Mac it's 01/01/1904 |
1146 | 1124 | * |
1147 | | - * @access private |
1148 | | - * |
1149 | | - * @param integer $numValue The raw Excel value to convert |
| 1125 | + * @param integer $timevalue The raw Excel value to convert |
1150 | 1126 | * |
1151 | 1127 | * @return array First element is the converted date, the second element is number a unix timestamp |
1152 | 1128 | */ |
1153 | | - public function createDate( $numValue ) { |
1154 | | - if ( $numValue > 1 ) { |
1155 | | - $utcDays = $numValue - ( $this->nineteenFour ? self::UTCOFFSETDAYS1904 : self::UTCOFFSETDAYS ); |
1156 | | - $utcValue = round( ( $utcDays + 1 ) * self::MSINADAY ); |
1157 | | - $string = $this->datetimeFormat ? gmdate( $this->datetimeFormat, $utcValue ) : gmdate( $this->curFormat, $utcValue ); |
1158 | | - $raw = $utcValue; |
1159 | | - } else { |
1160 | | - $raw = $numValue; |
1161 | | - $hours = floor( $numValue * 24 ); |
1162 | | - /** @noinspection SummerTimeUnsafeTimeManipulationInspection */ |
1163 | | - $mins = floor( $numValue * 24 * 60 ) - $hours * 60; |
1164 | | - $secs = floor( $numValue * self::MSINADAY ) - $hours * 60 * 60 - $mins * 60; |
1165 | | - $ts = mktime( $hours, $mins, $secs ); |
1166 | | - $string = $this->datetimeFormat ? gmdate( $this->datetimeFormat, $ts ) : gmdate( $this->curFormat, $ts ); |
| 1129 | + public function createDate( $timevalue ) { |
| 1130 | +// $offset = ($timeoffset===null)? date('Z') : $timeoffset * 3600; |
| 1131 | + if ($timevalue > 1) { |
| 1132 | + $timevalue -= ( $this->nineteenFour ? 24107 : 25569 ); |
1167 | 1133 | } |
| 1134 | + $ts = round($timevalue * 24 * 3600); |
| 1135 | + $string = $this->datetimeFormat ? gmdate( $this->datetimeFormat, $ts ) : gmdate( $this->curFormat, $ts ); |
| 1136 | + return array( $string, $ts ); |
1168 | 1137 |
|
1169 | | - return array( $string, $raw ); |
1170 | 1138 | } |
1171 | 1139 |
|
1172 | 1140 | public function addcell( $row, $col, $string, $raw = '' ) { |
|
0 commit comments