2
/* vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +----------------------------------------------------------------------+
5
// +----------------------------------------------------------------------+
6
// | Copyright (c) 1997-2002 The PHP Group |
7
// +----------------------------------------------------------------------+
8
// | This source file is subject to version 2.02 of the PHP license, |
9
// | that is bundled with this package in the file LICENSE, and is |
10
// | available at through the world-wide-web at |
11
// | http://www.php.net/license/2_02.txt. |
12
// | If you did not receive a copy of the PHP license and are unable to |
13
// | obtain it through the world-wide-web, please send a note to |
14
// | license@php.net so we can mail you a copy immediately. |
15
// +----------------------------------------------------------------------+
16
// | Author: Xavier Noguer <xnoguer@php.net> |
17
// | Based on OLE::Storage_Lite by Kawai, Takanori |
18
// +----------------------------------------------------------------------+
20
// $Id: File.php,v 1.11 2007/02/13 21:00:42 schmidt Exp $
23
/** PHPExcel root directory */
24
if (!defined('PHPEXCEL_ROOT')) {
28
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../');
31
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/OLE/OLE_PPS.php';
34
* Class for creating File PPS's for OLE containers
36
* @author Xavier Noguer <xnoguer@php.net>
38
* @package PHPExcel_Shared_OLE
40
class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS
43
* The temporary dir for storing the OLE file
52
* @param string $name The name of the file (in Unicode)
55
public function __construct($name)
61
PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE,
72
* Sets the temp dir used for storing the OLE file
75
* @param string $dir The dir to be used as temp dir
76
* @return true if given dir is valid, false otherwise
78
public function setTempDir($dir)
81
$this->_tmp_dir = $dir;
88
* Initialization method. Has to be called right after OLE_PPS_File().
91
* @return mixed true on success
93
public function init()
95
$this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_File");
96
$fh = fopen($this->_tmp_filename, "w+b");
98
throw new Exception("Can't create temporary file");
100
$this->_PPS_FILE = $fh;
101
if ($this->_PPS_FILE) {
102
fseek($this->_PPS_FILE, 0);
111
* @param string $data The data to append
113
public function append($data)
115
if ($this->_PPS_FILE) {
116
fwrite($this->_PPS_FILE, $data);
118
$this->_data .= $data;
123
* Returns a stream for reading this file using fread() etc.
124
* @return resource a read-only stream
126
public function getStream()
128
$this->ole->getStream($this);