Beispiel #1
0
 private function __readPropertySets()
 {
     $offset = 0;
     while ($offset < strlen($this->entry)) {
         $d = substr($this->entry, $offset, self::PROPERTY_STORAGE_BLOCK_SIZE);
         $nameSize = ord($d[self::SIZE_OF_NAME_POS]) | ord($d[self::SIZE_OF_NAME_POS + 1]) << 8;
         $type = ord($d[self::TYPE_POS]);
         $startBlock = ExelReaderHelper::GetInt4d($d, self::START_BLOCK_POS);
         $size = ExelReaderHelper::GetInt4d($d, self::SIZE_POS);
         $name = '';
         for ($i = 0; $i < $nameSize; $i++) {
             $name .= $d[$i];
         }
         $name = str_replace("", "", $name);
         $this->props[] = ['name' => $name, 'type' => $type, 'startBlock' => $startBlock, 'size' => $size];
         if (strtolower($name) == "workbook" || strtolower($name) == "book") {
             $this->wrkbook = count($this->props) - 1;
         }
         if ($name == "Root Entry") {
             $this->rootentry = count($this->props) - 1;
         }
         $offset += self::PROPERTY_STORAGE_BLOCK_SIZE;
     }
 }
 private function _getCellDetails($spos, $numValue, $column)
 {
     $xfindex = ord($this->data[$spos + 4]) | ord($this->data[$spos + 5]) << 8;
     $xfrecord = $this->xfRecords[$xfindex];
     $type = $xfrecord['type'];
     $format = $xfrecord['format'];
     $formatIndex = $xfrecord['formatIndex'];
     $fontIndex = $xfrecord['fontIndex'];
     $formatColor = "";
     $rectype = '';
     $string = '';
     $raw = '';
     if (isset($this->_columnsFormat[$column + 1])) {
         $format = $this->_columnsFormat[$column + 1];
     }
     if ($type == 'date') {
         // See http://groups.google.com/group/php-excel-reader-discuss/browse_frm/thread/9c3f9790d12d8e10/f2045c2369ac79de
         $rectype = 'date';
         // Convert numeric value into a date
         $utcDays = floor($numValue - ($this->nineteenFour ? self::SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS1904 : self::SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS));
         $utcValue = $utcDays * self::SPREADSHEET_EXCEL_READER_MSINADAY;
         $dateinfo = ExelReaderHelper::gmgetdate($utcValue);
         $raw = $numValue;
         $fractionalDay = $numValue - floor($numValue) + 1.0E-7;
         // The .0000001 is to fix for php/excel fractional diffs
         $totalseconds = floor(self::SPREADSHEET_EXCEL_READER_MSINADAY * $fractionalDay);
         $secs = $totalseconds % 60;
         $totalseconds -= $secs;
         $hours = floor($totalseconds / (60 * 60));
         $mins = floor($totalseconds / 60) % 60;
         $string = date($format, mktime($hours, $mins, $secs, $dateinfo["mon"], $dateinfo["mday"], $dateinfo["year"]));
     } else {
         if ($type == 'number') {
             $rectype = 'number';
             $formatted = $this->_format_value($format, $numValue, $formatIndex);
             $string = $formatted['string'];
             $formatColor = $formatted['formatColor'];
             $raw = $numValue;
         } else {
             if ($format == "") {
                 $format = $this->_defaultFormat;
             }
             $rectype = 'unknown';
             $formatted = $this->_format_value($format, $numValue, $formatIndex);
             $string = $formatted['string'];
             $formatColor = $formatted['formatColor'];
             $raw = $numValue;
         }
     }
     return ['string' => $string, 'raw' => $raw, 'rectype' => $rectype, 'format' => $format, 'formatIndex' => $formatIndex, 'fontIndex' => $fontIndex, 'formatColor' => $formatColor, 'xfIndex' => $xfindex];
 }