Esempio n. 1
0
 /**
  * Store the workbook in an OLE container
  *
  * @access private
  * @return mixed true on success. PEAR_Error on failure
  */
 function _storeOLEFile()
 {
     if ($this->_BIFF_version == 0x600) {
         $OLE = new OLE_PPS_File(OLE::Asc2Ucs('Workbook'));
     } else {
         $OLE = new OLE_PPS_File(OLE::Asc2Ucs('Book'));
     }
     if ($this->_tmp_dir != '') {
         $OLE->setTempDir($this->_tmp_dir);
     }
     $res = $OLE->init();
     if ($this->isError($res)) {
         return $this->raiseError("OLE Error: " . $res->getMessage());
     }
     $OLE->append($this->_data);
     $total_worksheets = count($this->_worksheets);
     for ($i = 0; $i < $total_worksheets; $i++) {
         while ($tmp = $this->_worksheets[$i]->getData()) {
             $OLE->append($tmp);
         }
     }
     $root = new OLE_PPS_Root(time(), time(), array($OLE));
     if ($this->_tmp_dir != '') {
         $root->setTempDir($this->_tmp_dir);
     }
     $res = $root->save($this->_filename);
     if ($this->isError($res)) {
         return $this->raiseError("OLE Error: " . $res->getMessage());
     }
     return true;
 }
 /**
  * Store the workbook in an OLE container
  *
  * @access private
  * @return mixed true on success. PEAR_Error on failure
  */
 protected function storeOLEFile()
 {
     if ($this->BIFF_version == 0x600) {
         $OLE = new OLE_PPS_File(OLE::Asc2Ucs('Workbook'));
     } else {
         $OLE = new OLE_PPS_File(OLE::Asc2Ucs('Book'));
     }
     if ($this->temporaryDirectory != '') {
         $OLE->setTempDir($this->temporaryDirectory);
     }
     $res = $OLE->init();
     if ($this->isError($res)) {
         return $this->raiseError('OLE Error: ' . $res->getMessage());
     }
     $OLE->append($this->data);
     $total_worksheets = count($this->workSheet);
     for ($i = 0; $i < $total_worksheets; ++$i) {
         while ($tmp = $this->workSheet[$i]->getData()) {
             $OLE->append($tmp);
         }
     }
     $root = new OLE_PPS_Root(time(), time(), array($OLE));
     if ($this->temporaryDirectory != '') {
         $root->setTempDir($this->temporaryDirectory);
     }
     $res = $root->save($this->fileName);
     if ($this->isError($res)) {
         return $this->raiseError('OLE Error: ' . $res->getMessage());
     }
     return true;
 }