public function PHPExcel_Shared_OLE_PPS_Root::save in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/OLE/PPS/Root.php \PHPExcel_Shared_OLE_PPS_Root::save()
* 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. * *
Parameters
string|resource $filename The name of the file or stream where to save the OLE container.: * @access public * @return mixed true on success
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Shared/ OLE/ PPS/ Root.php, line 71
Class
- PHPExcel_Shared_OLE_PPS_Root
- Class for creating Root PPS's for OLE containers
Code
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;
}