Exemplo n.º 1
0
 public function copyCellCollection(PHPExcel_Worksheet $parent)
 {
     parent::copyCellCollection($parent);
     $newCollection = array();
     foreach ($this->_cellCache as $k => &$cell) {
         $newCollection[$k] = clone $cell;
         $newCollection[$k]->attach($parent);
     }
     $this->_cellCache = $newCollection;
 }
Exemplo n.º 2
0
 /**
  * Clone the cell collection
  *
  * @param	PHPExcel_Worksheet	$parent		The new worksheet
  * @return	void
  */
 public function copyCellCollection(PHPExcel_Worksheet $parent)
 {
     parent::copyCellCollection($parent);
     //	Get a new id for the new file name
     $baseUnique = $this->_getUniqueID();
     $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.';
     $cacheList = $this->getCellList();
     foreach ($cacheList as $cellID) {
         if ($cellID != $this->_currentObjectID) {
             $obj = $this->_memcache->get($this->_cachePrefix . $cellID . '.cache');
             if ($obj === false) {
                 //	Entry no longer exists in Memcache, so clear it from the cache array
                 parent::deleteCacheData($cellID);
                 throw new PHPExcel_Exception('Cell entry ' . $cellID . ' no longer exists in MemCache');
             }
             if (!$this->_memcache->add($newCachePrefix . $cellID . '.cache', $obj, NULL, $this->_cacheTime)) {
                 $this->__destruct();
                 throw new PHPExcel_Exception('Failed to store cell ' . $cellID . ' in MemCache');
             }
         }
     }
     $this->_cachePrefix = $newCachePrefix;
 }
Exemplo n.º 3
0
 /**
  *	Clone the cell collection
  *
  *	@return	void
  */
 public function copyCellCollection(PHPExcel_Worksheet $parent)
 {
     parent::copyCellCollection($parent);
     //	Get a new id for the new file name
     $baseUnique = $this->_getUniqueID();
     $newFileName = PHPExcel_Shared_File::sys_get_temp_dir() . '/PHPExcel.' . $baseUnique . '.cache';
     //	Copy the existing cell cache file
     copy($this->_fileName, $newFileName);
     $this->_fileName = $newFileName;
     //	Open the copied cell cache file
     $this->_fileHandle = fopen($this->_fileName, 'a+');
 }
Exemplo n.º 4
0
 /**
  * Clone the cell collection
  *
  * @param    PHPExcel_Worksheet $parent The new worksheet
  *
  * @return    void
  */
 public function copyCellCollection(PHPExcel_Worksheet $parent)
 {
     parent::copyCellCollection($parent);
     //	Open a new stream for the cell cache data
     $newFileHandle = fopen('php://temp/maxmemory:' . $this->_memoryCacheSize, 'a+');
     //	Copy the existing cell cache data to the new stream
     fseek($this->_fileHandle, 0);
     while (!feof($this->_fileHandle)) {
         fwrite($newFileHandle, fread($this->_fileHandle, 1024));
     }
     $this->_fileHandle = $newFileHandle;
 }