Example #1
0
 /**
  * Save PHPExcel to file
  *
  * @param	string		$pFileName
  * @throws	Exception
  */
 public function save($pFilename = null)
 {
     // check mbstring.func_overload
     if (ini_get('mbstring.func_overload') != 0) {
         throw new Exception('Multibyte string function overloading in PHP must be disabled.');
     }
     // garbage collect
     $this->_phpExcel->garbageCollect();
     $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
     PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
     // initialize colors array
     $this->_colors = array();
     // Initialise workbook writer
     $this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, $this->_BIFF_version, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser);
     // Initialise worksheet writers
     $countSheets = count($this->_phpExcel->getAllSheets());
     for ($i = 0; $i < $countSheets; ++$i) {
         $phpSheet = $this->_phpExcel->getSheet($i);
         $writerWorksheet = new PHPExcel_Writer_Excel5_Worksheet($this->_BIFF_version, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser, $this->_preCalculateFormulas, $phpSheet);
         $this->_writerWorksheets[$i] = $writerWorksheet;
     }
     // add 15 identical cell style Xfs
     // for now, we use the first cellXf instead of cellStyleXf
     $cellXfCollection = $this->_phpExcel->getCellXfCollection();
     for ($i = 0; $i < 15; ++$i) {
         $this->_writerWorkbook->addXfWriter($cellXfCollection[0], true);
     }
     // add all the cell Xfs
     foreach ($this->_phpExcel->getCellXfCollection() as $style) {
         $this->_writerWorkbook->addXfWriter($style, false);
     }
     // initialize OLE file
     $workbookStreamName = $this->_BIFF_version == 0x600 ? 'Workbook' : 'Book';
     $OLE = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs($workbookStreamName));
     $OLE->init();
     // Write the worksheet streams before the global workbook stream,
     // because the byte sizes of these are needed in the global workbook stream
     $worksheetSizes = array();
     for ($i = 0; $i < $countSheets; ++$i) {
         $this->_writerWorksheets[$i]->close();
         $worksheetSizes[] = $this->_writerWorksheets[$i]->_datasize;
     }
     // add binary data for global workbook stream
     $OLE->append($this->_writerWorkbook->writeWorkbook($worksheetSizes));
     // add binary data for sheet streams
     for ($i = 0; $i < $countSheets; ++$i) {
         $OLE->append($this->_writerWorksheets[$i]->getData());
     }
     $root = new PHPExcel_Shared_OLE_PPS_Root(time(), time(), array($OLE));
     // save the OLE file
     $res = $root->save($pFilename);
     PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType);
 }
Example #2
0
 /**
  * Save PHPExcel to file
  *
  * @param	string		$pFileName
  * @throws	Exception
  */
 public function save($pFilename = null)
 {
     // garbage collect
     $this->_phpExcel->garbageCollect();
     $saveDebugLog = PHPExcel_Calculation::getInstance()->writeDebugLog;
     PHPExcel_Calculation::getInstance()->writeDebugLog = false;
     $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
     PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
     // initialize colors array
     $this->_colors = array();
     // Initialise workbook writer
     $this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, $this->_BIFF_version, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser);
     // Initialise worksheet writers
     $countSheets = $this->_phpExcel->getSheetCount();
     for ($i = 0; $i < $countSheets; ++$i) {
         $this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_BIFF_version, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser, $this->_preCalculateFormulas, $this->_phpExcel->getSheet($i));
     }
     // build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.
     $this->_buildWorksheetEschers();
     $this->_buildWorkbookEscher();
     // add 15 identical cell style Xfs
     // for now, we use the first cellXf instead of cellStyleXf
     $cellXfCollection = $this->_phpExcel->getCellXfCollection();
     for ($i = 0; $i < 15; ++$i) {
         $this->_writerWorkbook->addXfWriter($cellXfCollection[0], true);
     }
     // add all the cell Xfs
     foreach ($this->_phpExcel->getCellXfCollection() as $style) {
         $this->_writerWorkbook->addXfWriter($style, false);
     }
     // initialize OLE file
     $workbookStreamName = $this->_BIFF_version == 0x600 ? 'Workbook' : 'Book';
     $OLE = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs($workbookStreamName));
     // Write the worksheet streams before the global workbook stream,
     // because the byte sizes of these are needed in the global workbook stream
     $worksheetSizes = array();
     for ($i = 0; $i < $countSheets; ++$i) {
         $this->_writerWorksheets[$i]->close();
         $worksheetSizes[] = $this->_writerWorksheets[$i]->_datasize;
     }
     // add binary data for global workbook stream
     $OLE->append($this->_writerWorkbook->writeWorkbook($worksheetSizes));
     // add binary data for sheet streams
     for ($i = 0; $i < $countSheets; ++$i) {
         $OLE->append($this->_writerWorksheets[$i]->getData());
     }
     $root = new PHPExcel_Shared_OLE_PPS_Root(time(), time(), array($OLE));
     // save the OLE file
     $res = $root->save($pFilename);
     PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType);
     PHPExcel_Calculation::getInstance()->writeDebugLog = $saveDebugLog;
 }
Example #3
0
 /**
  * Build CSS styles
  *
  * @param	boolean	$generateSurroundingHTML	Generate surrounding HTML style? (html { })
  * @return	array
  * @throws	PHPExcel_Writer_Exception
  */
 public function buildCSS($generateSurroundingHTML = true)
 {
     // PHPExcel object known?
     if (is_null($this->_phpExcel)) {
         throw new PHPExcel_Writer_Exception('Internal PHPExcel object not set to an instance of an object.');
     }
     // Cached?
     if (!is_null($this->_cssStyles)) {
         return $this->_cssStyles;
     }
     // Ensure that spans have been calculated
     if (!$this->_spansAreCalculated) {
         $this->_calculateSpans();
     }
     // Construct CSS
     $css = array();
     // Start styles
     if ($generateSurroundingHTML) {
         // html { }
         $css['html']['font-family'] = 'Calibri, Arial, Helvetica, sans-serif';
         $css['html']['font-size'] = '11pt';
         $css['html']['background-color'] = 'white';
     }
     // table { }
     $css['table']['border-collapse'] = 'collapse';
     if (!$this->_isPdf) {
         $css['table']['page-break-after'] = 'always';
     }
     // .gridlines td { }
     $css['.gridlines td']['border'] = '1px dotted black';
     // .b {}
     $css['.b']['text-align'] = 'center';
     // BOOL
     // .e {}
     $css['.e']['text-align'] = 'center';
     // ERROR
     // .f {}
     $css['.f']['text-align'] = 'right';
     // FORMULA
     // .inlineStr {}
     $css['.inlineStr']['text-align'] = 'left';
     // INLINE
     // .n {}
     $css['.n']['text-align'] = 'right';
     // NUMERIC
     // .s {}
     $css['.s']['text-align'] = 'left';
     // STRING
     // Calculate cell style hashes
     foreach ($this->_phpExcel->getCellXfCollection() as $index => $style) {
         $css['td.style' . $index] = $this->_createCSSStyle($style);
     }
     // Fetch sheets
     $sheets = array();
     if (is_null($this->_sheetIndex)) {
         $sheets = $this->_phpExcel->getAllSheets();
     } else {
         $sheets[] = $this->_phpExcel->getSheet($this->_sheetIndex);
     }
     // Build styles per sheet
     foreach ($sheets as $sheet) {
         // Calculate hash code
         $sheetIndex = $sheet->getParent()->getIndex($sheet);
         // Build styles
         // Calculate column widths
         $sheet->calculateColumnWidths();
         // col elements, initialize
         $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn()) - 1;
         $column = -1;
         while ($column++ < $highestColumnIndex) {
             $this->_columnWidths[$sheetIndex][$column] = 42;
             // approximation
             $css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = '42pt';
         }
         // col elements, loop through columnDimensions and set width
         foreach ($sheet->getColumnDimensions() as $columnDimension) {
             if (($width = PHPExcel_Shared_Drawing::cellDimensionToPixels($columnDimension->getWidth(), $this->_defaultFont)) >= 0) {
                 $width = PHPExcel_Shared_Drawing::pixelsToPoints($width);
                 $column = PHPExcel_Cell::columnIndexFromString($columnDimension->getColumnIndex()) - 1;
                 $this->_columnWidths[$sheetIndex][$column] = $width;
                 $css['table.sheet' . $sheetIndex . ' col.col' . $column]['width'] = $width . 'pt';
                 if ($columnDimension->getVisible() === false) {
                     $css['table.sheet' . $sheetIndex . ' col.col' . $column]['visibility'] = 'collapse';
                     $css['table.sheet' . $sheetIndex . ' col.col' . $column]['*display'] = 'none';
                     // target IE6+7
                 }
             }
         }
         // Default row height
         $rowDimension = $sheet->getDefaultRowDimension();
         // table.sheetN tr { }
         $css['table.sheet' . $sheetIndex . ' tr'] = array();
         if ($rowDimension->getRowHeight() == -1) {
             $pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->_phpExcel->getDefaultStyle()->getFont());
         } else {
             $pt_height = $rowDimension->getRowHeight();
         }
         $css['table.sheet' . $sheetIndex . ' tr']['height'] = $pt_height . 'pt';
         if ($rowDimension->getVisible() === false) {
             $css['table.sheet' . $sheetIndex . ' tr']['display'] = 'none';
             $css['table.sheet' . $sheetIndex . ' tr']['visibility'] = 'hidden';
         }
         // Calculate row heights
         foreach ($sheet->getRowDimensions() as $rowDimension) {
             $row = $rowDimension->getRowIndex() - 1;
             // table.sheetN tr.rowYYYYYY { }
             $css['table.sheet' . $sheetIndex . ' tr.row' . $row] = array();
             if ($rowDimension->getRowHeight() == -1) {
                 $pt_height = PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->_phpExcel->getDefaultStyle()->getFont());
             } else {
                 $pt_height = $rowDimension->getRowHeight();
             }
             $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['height'] = $pt_height . 'pt';
             if ($rowDimension->getVisible() === false) {
                 $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['display'] = 'none';
                 $css['table.sheet' . $sheetIndex . ' tr.row' . $row]['visibility'] = 'hidden';
             }
         }
     }
     // Cache
     if (is_null($this->_cssStyles)) {
         $this->_cssStyles = $css;
     }
     // Return
     return $css;
 }
Example #4
0
 /**
  * Get an array of all styles
  *
  * @param 	PHPExcel				$pPHPExcel
  * @return 	PHPExcel_Style[]		All styles in PHPExcel
  * @throws 	Exception
  */
 public function allStyles(PHPExcel $pPHPExcel = null)
 {
     $aStyles = $pPHPExcel->getCellXfCollection();
     return $aStyles;
 }
 /**
  * Save PHPExcel to file
  *
  * @param    string $pFilename
  *
  * @throws    PHPExcel_Writer_Exception
  */
 public function save($pFilename = null)
 {
     // garbage collect
     $this->_phpExcel->garbageCollect();
     $saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
     PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false);
     $saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
     PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
     // initialize colors array
     $this->_colors = array();
     // Initialise workbook writer
     $this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser);
     // Initialise worksheet writers
     $countSheets = $this->_phpExcel->getSheetCount();
     for ($i = 0; $i < $countSheets; ++$i) {
         $this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser, $this->_preCalculateFormulas, $this->_phpExcel->getSheet($i));
     }
     // build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.
     $this->_buildWorksheetEschers();
     $this->_buildWorkbookEscher();
     // add 15 identical cell style Xfs
     // for now, we use the first cellXf instead of cellStyleXf
     $cellXfCollection = $this->_phpExcel->getCellXfCollection();
     for ($i = 0; $i < 15; ++$i) {
         $this->_writerWorkbook->addXfWriter($cellXfCollection[0], true);
     }
     // add all the cell Xfs
     foreach ($this->_phpExcel->getCellXfCollection() as $style) {
         $this->_writerWorkbook->addXfWriter($style, false);
     }
     // add fonts from rich text eleemnts
     for ($i = 0; $i < $countSheets; ++$i) {
         foreach ($this->_writerWorksheets[$i]->_phpSheet->getCellCollection() as $cellID) {
             $cell = $this->_writerWorksheets[$i]->_phpSheet->getCell($cellID);
             $cVal = $cell->getValue();
             if ($cVal instanceof PHPExcel_RichText) {
                 $elements = $cVal->getRichTextElements();
                 foreach ($elements as $element) {
                     if ($element instanceof PHPExcel_RichText_Run) {
                         $font = $element->getFont();
                         $this->_writerWorksheets[$i]->_fntHashIndex[$font->getHashCode()] = $this->_writerWorkbook->_addFont($font);
                     }
                 }
             }
         }
     }
     // initialize OLE file
     $workbookStreamName = 'Workbook';
     $OLE = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs($workbookStreamName));
     // Write the worksheet streams before the global workbook stream,
     // because the byte sizes of these are needed in the global workbook stream
     $worksheetSizes = array();
     for ($i = 0; $i < $countSheets; ++$i) {
         $this->_writerWorksheets[$i]->close();
         $worksheetSizes[] = $this->_writerWorksheets[$i]->_datasize;
     }
     // add binary data for global workbook stream
     $OLE->append($this->_writerWorkbook->writeWorkbook($worksheetSizes));
     // add binary data for sheet streams
     for ($i = 0; $i < $countSheets; ++$i) {
         $OLE->append($this->_writerWorksheets[$i]->getData());
     }
     $this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation();
     // initialize OLE Document Summary Information
     if (isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)) {
         $OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation'));
         $OLE_DocumentSummaryInformation->append($this->_documentSummaryInformation);
     }
     $this->_summaryInformation = $this->_writeSummaryInformation();
     // initialize OLE Summary Information
     if (isset($this->_summaryInformation) && !empty($this->_summaryInformation)) {
         $OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
         $OLE_SummaryInformation->append($this->_summaryInformation);
     }
     // define OLE Parts
     $arrRootData = array($OLE);
     // initialize OLE Properties file
     if (isset($OLE_SummaryInformation)) {
         $arrRootData[] = $OLE_SummaryInformation;
     }
     // initialize OLE Extended Properties file
     if (isset($OLE_DocumentSummaryInformation)) {
         $arrRootData[] = $OLE_DocumentSummaryInformation;
     }
     $root = new PHPExcel_Shared_OLE_PPS_Root(time(), time(), $arrRootData);
     // save the OLE file
     $res = $root->save($pFilename);
     PHPExcel_Calculation_Functions::setReturnDateType($saveDateReturnType);
     PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog);
 }
Example #6
-1
    /**
	 * Reads a general type of BIFF record. Does nothing except for moving stream pointer forward to next record.
	 */
    private function _readDefault()
    {
        $length = self::_GetInt2d($this->_data, $this->_pos + 2);
        //		$recordData = substr($this->_data, $this->_pos + 4, $length);
        // move stream pointer to next record
        $this->_pos += 4 + $length;
    }
    /**
	 *	The NOTE record specifies a comment associated with a particular cell. In Excel 95 (BIFF7) and earlier versions,
	 *		this record stores a note (cell note). This feature was significantly enhanced in Excel 97.
	 */
    private function _readNote()
    {
        //		echo '<b>Read Cell Annotation</b><br>';
        $length = self::_GetInt2d($this->_data, $this->_pos + 2);
        $recordData = substr($this->_data, $this->_pos + 4, $length);
        // move stream pointer to next record
        $this->_pos += 4 + $length;
        if ($this->_readDataOnly) {
            return;
        }
        $cellAddress = $this->_readBIFF8CellAddress(substr($recordData, 0, 4));
        if ($this->_version == self::XLS_BIFF8) {
            $noteObjID = self::_GetInt2d($recordData, 6);
            $noteAuthor = self::_readUnicodeStringLong(substr($recordData, 8));
            $noteAuthor = $noteAuthor['value'];
            //			echo 'Note Address=',$cellAddress,'<br>';
            //			echo 'Note Object ID=',$noteObjID,'<br>';
            //			echo 'Note Author=',$noteAuthor,'<hr />';
            //
            $this->_cellNotes[$noteObjID] = array('cellRef' => $cellAddress, 'objectID' => $noteObjID, 'author' => $noteAuthor);
        } else {
            $extension = false;
            if ($cellAddress == '$B$65536') {
                //	If the address row is -1 and the column is 0, (which translates as $B$65536) then this is a continuation
                //		note from the previous cell annotation. We're not yet handling this, so annotations longer than the
                //		max 2048 bytes will probably throw a wobbly.
                $row = self::_GetInt2d($recordData, 0);
                $extension = true;
                $cellAddress = array_pop(array_keys($this->_phpSheet->getComments()));
            }
            //			echo 'Note Address=',$cellAddress,'<br>';
            $cellAddress = str_replace('$', '', $cellAddress);
            $noteLength = self::_GetInt2d($recordData, 4);
            $noteText = trim(substr($recordData, 6));
            //			echo 'Note Length=',$noteLength,'<br>';
            //			echo 'Note Text=',$noteText,'<br>';
            if ($extension) {
                //	Concatenate this extension with the currently set comment for the cell
                $comment = $this->_phpSheet->getComment($cellAddress);
                $commentText = $comment->getText()->getPlainText();
                $comment->setText($this->_parseRichText($commentText . $noteText));
            } else {
                //	Set comment for the cell
                $this->_phpSheet->getComment($cellAddress)->setText($this->_parseRichText($noteText));
            }
        }
    }
    /**
	 *	The TEXT Object record contains the text associated with a cell annotation.
	 */
    private function _readTextObject()
    {
        $length = self::_GetInt2d($this->_data, $this->_pos + 2);
        $recordData = substr($this->_data, $this->_pos + 4, $length);
        // move stream pointer to next record
        $this->_pos += 4 + $length;
        if ($this->_readDataOnly) {
            return;
        }
        // recordData consists of an array of subrecords looking like this:
        //	grbit: 2 bytes; Option Flags
        //	rot: 2 bytes; rotation
        //	cchText: 2 bytes; length of the text (in the first continue record)
        //	cbRuns: 2 bytes; length of the formatting (in the second continue record)
        // followed by the continuation records containing the actual text and formatting
        $grbitOpts = self::_GetInt2d($recordData, 0);
        $rot = self::_GetInt2d($recordData, 2);
        $cchText = self::_GetInt2d($recordData, 10);
        $cbRuns = self::_GetInt2d($recordData, 12);
        $text = $this->_getSplicedRecordData();
        $this->_textObjects[$this->textObjRef] = array('text' => substr($text["recordData"], $text["spliceOffsets"][0] + 1, $cchText), 'format' => substr($text["recordData"], $text["spliceOffsets"][1], $cbRuns), 'alignment' => $grbitOpts, 'rotation' => $rot);
        //		echo '<b>_readTextObject()</b><br>';
        //		var_dump($this->_textObjects[$this->textObjRef]);
        //		echo '<br>';
    }
    /**
	 * Read BOF
	 */
    private function _readBof()
    {
        $length = self::_GetInt2d($this->_data, $this->_pos + 2);
        $recordData = substr($this->_data, $this->_pos + 4, $length);
        // move stream pointer to next record
        $this->_pos += 4 + $length;
        // offset: 2; size: 2; type of the following data
        $substreamType = self::_GetInt2d($recordData, 2);
        switch ($substreamType) {
            case self::XLS_WorkbookGlobals:
                $version = self::_GetInt2d($recordData, 0);
                if ($version != self::XLS_BIFF8 && $version != self::XLS_BIFF7) {
                    throw new Exception('Cannot read this Excel file. Version is too old.');
                }
                $this->_version = $version;
                break;
            case self::XLS_Worksheet:
                // do not use this version information for anything
                // it is unreliable (OpenOffice doc, 5.8), use only version information from the global stream
                break;
            default:
                // substream, e.g. chart
                // just skip the entire substream
                do {
                    $code = self::_GetInt2d($this->_data, $this->_pos);
                    $this->_readDefault();
                } while ($code != self::XLS_Type_EOF && $this->_pos < $this->_dataSize);
                break;
        }
    }
    /**
	 * FILEPASS
	 *
	 * This record is part of the File Protection Block. It
	 * contains information about the read/write password of the
	 * file. All record contents following this record will be
	 * encrypted.
	 *
	 * --	"OpenOffice.org's Documentation of the Microsoft
	 * 		Excel File Format"
	 */
    private function _readFilepass()
    {
        $length = self::_GetInt2d($this->_data, $this->_pos + 2);
        //		$recordData = substr($this->_data, $this->_pos + 4, $length);
        // move stream pointer to next record
        $this->_pos += 4 + $length;
        throw new Exception('Cannot read encrypted file');
    }
    /**
	 * CODEPAGE
	 *
	 * This record stores the text encoding used to write byte
	 * strings, stored as MS Windows code page identifier.
	 *
	 * --	"OpenOffice.org's Documentation of the Microsoft
	 * 		Excel File Format"
	 */
    private function _readCodepage()
    {
        $length = self::_GetInt2d($this->_data, $this->_pos + 2);
        $recordData = substr($this->_data, $this->_pos + 4, $length);
        // move stream pointer to next record
        $this->_pos += 4 + $length;
        // offset: 0; size: 2; code page identifier
        $codepage = self::_GetInt2d($recordData, 0);
        $this->_codepage = PHPExcel_Shared_CodePage::NumberToName($codepage);
    }
    /**
	 * DATEMODE
	 *
	 * This record specifies the base date for displaying date
	 * values. All dates are stored as count of days past this
	 * base date. In BIFF2-BIFF4 this record is part of the
	 * Calculation Settings Block. In BIFF5-BIFF8 it is
	 * stored in the Workbook Globals Substream.
	 *
	 * --	"OpenOffice.org's Documentation of the Microsoft
	 * 		Excel File Format"
	 */
    private function _readDateMode()
    {
        $length = self::_GetInt2d($this->_data, $this->_pos + 2);
        $recordData = substr($this->_data, $this->_pos + 4, $length);
        // move stream pointer to next record
        $this->_pos += 4 + $length;
        // offset: 0; size: 2; 0 = base 1900, 1 = base 1904
        PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
        if (ord($recordData[0]) == 1) {
            PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
        }
    }
    /**
	 * Read a FONT record
	 */
    private function _readFont()
    {
        $length = self::_GetInt2d($this->_data, $this->_pos + 2);
        $recordData = substr($this->_data, $this->_pos + 4, $length);
        // move stream pointer to next record
        $this->_pos += 4 + $length;
        if (!$this->_readDataOnly) {
            $objFont = new PHPExcel_Style_Font();
            // offset: 0; size: 2; height of the font (in twips = 1/20 of a point)
            $size = self::_GetInt2d($recordData, 0);
            $objFont->setSize($size / 20);
            // offset: 2; size: 2; option flags
            // bit: 0; mask 0x0001; bold (redundant in BIFF5-BIFF8)
            // bit: 1; mask 0x0002; italic
            $isItalic = (0x2 & self::_GetInt2d($recordData, 2)) >> 1;
            if ($isItalic) {
                $objFont->setItalic(true);
            }
            // bit: 2; mask 0x0004; underlined (redundant in BIFF5-BIFF8)
            // bit: 3; mask 0x0008; strike
            $isStrike = (0x8 & self::_GetInt2d($recordData, 2)) >> 3;
            if ($isStrike) {
                $objFont->setStrikethrough(true);
            }
            // offset: 4; size: 2; colour index
            $colorIndex = self::_GetInt2d($recordData, 4);
            $objFont->colorIndex = $colorIndex;
            // offset: 6; size: 2; font weight
            $weight = self::_GetInt2d($recordData, 6);
            switch ($weight) {
                case 0x2bc:
                    $objFont->setBold(true);
                    break;
            }
            // offset: 8; size: 2; escapement type
            $escapement = self::_GetInt2d($recordData, 8);
            switch ($escapement) {
                case 0x1:
                    $objFont->setSuperScript(true);
                    break;
                case 0x2:
                    $objFont->setSubScript(true);
                    break;
            }
            // offset: 10; size: 1; underline type
            $underlineType = ord($recordData[10]);
            switch ($underlineType) {
                case 0x0:
                    break;
                    // no underline
                // no underline
                case 0x1: