Example #1
0
	/**
	* The constructor
	*
	* @access public
	* @param string $name The name of the file (in Unicode)
	* @see OLE::Asc2Ucs()
	*/
	public function __construct($name)
	{
		$this->_tmp_dir = '';
		parent::__construct(
			null, 
			$name,
			PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE,
			null,
			null,
			null,
			null,
			null,
			'',
			array());
	}
Example #2
0
	/**
	 * @param integer $time_1st A timestamp
	 * @param integer $time_2nd A timestamp
	 */
	public function __construct($time_1st, $time_2nd, $raChild)
	{
		$this->_tmp_dir = '';
		parent::__construct(
		   null,
		   PHPExcel_Shared_OLE::Asc2Ucs('Root Entry'),
		   PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT,
		   null,
		   null,
		   null,
		   $time_1st,
		   $time_2nd,
		   null,
		   $raChild);
	}
Example #3
0
 /**
  * Method for saving the whole OLE container (including files).
  * In fact, if called with an empty argument (or '-'), it saves to a
  * temporary file and then outputs it's contents to stdout.
  * If a resource pointer to a stream created by fopen() is passed
  * it will be used, but you have to close such stream by yourself.
  *
  * @param string|resource $filename The name of the file or stream where to save the OLE container.
  *
  * @access public
  * @return mixed true on success
  */
 public function save($filename)
 {
     // Initial Setting for saving
     $this->_BIG_BLOCK_SIZE = pow(2, isset($this->_BIG_BLOCK_SIZE) ? self::_adjust2($this->_BIG_BLOCK_SIZE) : 9);
     $this->_SMALL_BLOCK_SIZE = pow(2, isset($this->_SMALL_BLOCK_SIZE) ? self::_adjust2($this->_SMALL_BLOCK_SIZE) : 6);
     if (is_resource($filename)) {
         $this->_FILEH_ = $filename;
     } else {
         if ($filename == '-' || $filename == '') {
             if ($this->_tmp_dir === null) {
                 $this->_tmp_dir = PHPExcel_Shared_File::sys_get_temp_dir();
             }
             $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_Root");
             $this->_FILEH_ = fopen($this->_tmp_filename, "w+b");
             if ($this->_FILEH_ == false) {
                 throw new PHPExcel_Writer_Exception("Can't create temporary file.");
             }
         } else {
             $this->_FILEH_ = fopen($filename, "wb");
         }
     }
     if ($this->_FILEH_ == false) {
         throw new PHPExcel_Writer_Exception("Can't open {$filename}. It may be in use or protected.");
     }
     // Make an array of PPS's (for Save)
     $aList = array();
     PHPExcel_Shared_OLE_PPS::_savePpsSetPnt($aList, array($this));
     // calculate values for header
     list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList);
     //, $rhInfo);
     // Save Header
     $this->_saveHeader($iSBDcnt, $iBBcnt, $iPPScnt);
     // Make Small Data string (write SBD)
     $this->_data = $this->_makeSmallData($aList);
     // Write BB
     $this->_saveBigData($iSBDcnt, $aList);
     // Write PPS
     $this->_savePps($aList);
     // Write Big Block Depot and BDList and Adding Header informations
     $this->_saveBbd($iSBDcnt, $iBBcnt, $iPPScnt);
     if (!is_resource($filename)) {
         fclose($this->_FILEH_);
     }
     return true;
 }