Modify underlying PHP_OLE to support multiple streams
This is preparatory to providing support for workbook properties (and extended properties) in the Excel5 Writer, because properties are stored in the SummaryInformation and DocumentSummaryInformation streams, and not in the workbook stream. Previously, PHP_OLE could only save a single stream, so this had to be the workbook stream; so document property information was discarded by the Excel5 Writer. git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@77804 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
94e3dc3fd2
commit
bb34668146
|
@ -196,21 +196,35 @@ class PHPExcel_Shared_OLE_PPS
|
||||||
* PPS. I don't think it'll work with Dir PPS's.
|
* PPS. I don't think it'll work with Dir PPS's.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array &$pps_array Reference to the array of PPS's for the whole OLE
|
* @param array &$raList Reference to the array of PPS's for the whole OLE
|
||||||
* container
|
* container
|
||||||
* @return integer The index for this PPS
|
* @return integer The index for this PPS
|
||||||
*/
|
*/
|
||||||
public function _savePpsSetPnt(&$pps_array)
|
public static function _savePpsSetPnt(&$raList, $to_save, $depth = 0)
|
||||||
{
|
{
|
||||||
$pps_array[count($pps_array)] = &$this;
|
if ( !is_array($to_save) || (count($to_save) == 0) ) {
|
||||||
$this->No = count($pps_array) - 1;
|
return 0xFFFFFFFF;
|
||||||
$this->PrevPps = 0xFFFFFFFF;
|
} elseif( count($to_save) == 1 ) {
|
||||||
$this->NextPps = 0xFFFFFFFF;
|
$cnt = count($raList);
|
||||||
if (count($this->children) > 0) {
|
// If the first entry, it's the root... Don't clone it!
|
||||||
$this->DirPps = $this->children[0]->_savePpsSetPnt($pps_array);
|
$raList[$cnt] = ( $depth == 0 ) ? $to_save[0] : clone $to_save[0];
|
||||||
|
$raList[$cnt]->No = $cnt;
|
||||||
|
$raList[$cnt]->PrevPps = 0xFFFFFFFF;
|
||||||
|
$raList[$cnt]->NextPps = 0xFFFFFFFF;
|
||||||
|
$raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++);
|
||||||
} else {
|
} else {
|
||||||
$this->DirPps = 0xFFFFFFFF;
|
$iPos = floor(count($to_save) / 2);
|
||||||
|
$aPrev = array_slice($to_save, 0, $iPos);
|
||||||
|
$aNext = array_slice($to_save, $iPos + 1);
|
||||||
|
$cnt = count($raList);
|
||||||
|
// If the first entry, it's the root... Don't clone it!
|
||||||
|
$raList[$cnt] = ( $depth == 0 ) ? $to_save[$iPos] : clone $to_save[$iPos];
|
||||||
|
$raList[$cnt]->No = $cnt;
|
||||||
|
$raList[$cnt]->PrevPps = self::_savePpsSetPnt($raList, $aPrev, $depth++);
|
||||||
|
$raList[$cnt]->NextPps = self::_savePpsSetPnt($raList, $aNext, $depth++);
|
||||||
|
$raList[$cnt]->DirPps = self::_savePpsSetPnt($raList, @$raList[$cnt]->children, $depth++);
|
||||||
|
|
||||||
}
|
}
|
||||||
return $this->No;
|
return $cnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||||
}
|
}
|
||||||
// Make an array of PPS's (for Save)
|
// Make an array of PPS's (for Save)
|
||||||
$aList = array();
|
$aList = array();
|
||||||
$this->_savePpsSetPnt($aList);
|
PHPExcel_Shared_OLE_PPS::_savePpsSetPnt($aList, array($this));
|
||||||
// calculate values for header
|
// calculate values for header
|
||||||
list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); //, $rhInfo);
|
list($iSBDcnt, $iBBcnt, $iPPScnt) = $this->_calcSize($aList); //, $rhInfo);
|
||||||
// Save Header
|
// Save Header
|
||||||
|
@ -227,8 +227,8 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
||||||
// Extra BDList Start, Count
|
// Extra BDList Start, Count
|
||||||
if ($iBdCnt < $i1stBdL) {
|
if ($iBdCnt < $i1stBdL) {
|
||||||
fwrite($FILE,
|
fwrite($FILE,
|
||||||
pack("V", -2). // Extra BDList Start
|
pack("V", -2) // Extra BDList Start
|
||||||
pack("V", 0) // Extra BDList Count
|
. pack("V", 0) // Extra BDList Count
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL));
|
fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL));
|
||||||
|
|
Loading…
Reference in New Issue