= -1; --$k) { - if ($k == -1) { - break; - } - if (abs($e[$k]) <= $eps * (abs($this->s[$k]) + abs($this->s[$k+1]))) { - $e[$k] = 0.0; - break; - } - } - if ($k == $p - 2) { - $kase = 4; - } else { - for ($ks = $p - 1; $ks >= $k; --$ks) { - if ($ks == $k) { - break; - } - $t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks-1]) : 0.); - if (abs($this->s[$ks]) <= $eps * $t) { - $this->s[$ks] = 0.0; - break; - } - } - if ($ks == $k) { - $kase = 3; - } else if ($ks == $p-1) { - $kase = 1; - } else { - $kase = 2; - $k = $ks; - } - } - ++$k; + while ($p > 0) { + // Here is where a test for too many iterations would go. + // This section of the program inspects for negligible + // elements in the s and e arrays. On completion the + // variables kase and k are set as follows: + // kase = 1 if s(p) and e[k-1] are negligible and k
= -1; --$k) {
+ if ($k == -1) {
+ break;
+ }
+ if (abs($e[$k]) <= $eps * (abs($this->s[$k]) + abs($this->s[$k+1]))) {
+ $e[$k] = 0.0;
+ break;
+ }
+ }
+ if ($k == $p - 2) {
+ $kase = 4;
+ } else {
+ for ($ks = $p - 1; $ks >= $k; --$ks) {
+ if ($ks == $k) {
+ break;
+ }
+ $t = ($ks != $p ? abs($e[$ks]) : 0.) + ($ks != $k + 1 ? abs($e[$ks-1]) : 0.);
+ if (abs($this->s[$ks]) <= $eps * $t) {
+ $this->s[$ks] = 0.0;
+ break;
+ }
+ }
+ if ($ks == $k) {
+ $kase = 3;
+ } else if ($ks == $p-1) {
+ $kase = 1;
+ } else {
+ $kase = 2;
+ $k = $ks;
+ }
+ }
+ ++$k;
- // Perform the task indicated by kase.
- switch ($kase) {
- // Deflate negligible s(p).
- case 1:
- $f = $e[$p-2];
- $e[$p-2] = 0.0;
- for ($j = $p - 2; $j >= $k; --$j) {
- $t = hypo($this->s[$j],$f);
- $cs = $this->s[$j] / $t;
- $sn = $f / $t;
- $this->s[$j] = $t;
- if ($j != $k) {
- $f = -$sn * $e[$j-1];
- $e[$j-1] = $cs * $e[$j-1];
- }
- if ($wantv) {
- for ($i = 0; $i < $this->n; ++$i) {
- $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$p-1];
- $this->V[$i][$p-1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$p-1];
- $this->V[$i][$j] = $t;
- }
- }
- }
- break;
- // Split at negligible s(k).
- case 2:
- $f = $e[$k-1];
- $e[$k-1] = 0.0;
- for ($j = $k; $j < $p; ++$j) {
- $t = hypo($this->s[$j], $f);
- $cs = $this->s[$j] / $t;
- $sn = $f / $t;
- $this->s[$j] = $t;
- $f = -$sn * $e[$j];
- $e[$j] = $cs * $e[$j];
- if ($wantu) {
- for ($i = 0; $i < $this->m; ++$i) {
- $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k-1];
- $this->U[$i][$k-1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$k-1];
- $this->U[$i][$j] = $t;
- }
- }
- }
- break;
- // Perform one qr step.
- case 3:
- // Calculate the shift.
- $scale = max(max(max(max(
- abs($this->s[$p-1]),abs($this->s[$p-2])),abs($e[$p-2])),
- abs($this->s[$k])), abs($e[$k]));
- $sp = $this->s[$p-1] / $scale;
- $spm1 = $this->s[$p-2] / $scale;
- $epm1 = $e[$p-2] / $scale;
- $sk = $this->s[$k] / $scale;
- $ek = $e[$k] / $scale;
- $b = (($spm1 + $sp) * ($spm1 - $sp) + $epm1 * $epm1) / 2.0;
- $c = ($sp * $epm1) * ($sp * $epm1);
- $shift = 0.0;
- if (($b != 0.0) || ($c != 0.0)) {
- $shift = sqrt($b * $b + $c);
- if ($b < 0.0) {
- $shift = -$shift;
- }
- $shift = $c / ($b + $shift);
- }
- $f = ($sk + $sp) * ($sk - $sp) + $shift;
- $g = $sk * $ek;
- // Chase zeros.
- for ($j = $k; $j < $p-1; ++$j) {
- $t = hypo($f,$g);
- $cs = $f/$t;
- $sn = $g/$t;
- if ($j != $k) {
- $e[$j-1] = $t;
- }
- $f = $cs * $this->s[$j] + $sn * $e[$j];
- $e[$j] = $cs * $e[$j] - $sn * $this->s[$j];
- $g = $sn * $this->s[$j+1];
- $this->s[$j+1] = $cs * $this->s[$j+1];
- if ($wantv) {
- for ($i = 0; $i < $this->n; ++$i) {
- $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$j+1];
- $this->V[$i][$j+1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$j+1];
- $this->V[$i][$j] = $t;
- }
- }
- $t = hypo($f,$g);
- $cs = $f/$t;
- $sn = $g/$t;
- $this->s[$j] = $t;
- $f = $cs * $e[$j] + $sn * $this->s[$j+1];
- $this->s[$j+1] = -$sn * $e[$j] + $cs * $this->s[$j+1];
- $g = $sn * $e[$j+1];
- $e[$j+1] = $cs * $e[$j+1];
- if ($wantu && ($j < $this->m - 1)) {
- for ($i = 0; $i < $this->m; ++$i) {
- $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$j+1];
- $this->U[$i][$j+1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$j+1];
- $this->U[$i][$j] = $t;
- }
- }
- }
- $e[$p-2] = $f;
- $iter = $iter + 1;
- break;
- // Convergence.
- case 4:
- // Make the singular values positive.
- if ($this->s[$k] <= 0.0) {
- $this->s[$k] = ($this->s[$k] < 0.0 ? -$this->s[$k] : 0.0);
- if ($wantv) {
- for ($i = 0; $i <= $pp; ++$i) {
- $this->V[$i][$k] = -$this->V[$i][$k];
- }
- }
- }
- // Order the singular values.
- while ($k < $pp) {
- if ($this->s[$k] >= $this->s[$k+1]) {
- break;
- }
- $t = $this->s[$k];
- $this->s[$k] = $this->s[$k+1];
- $this->s[$k+1] = $t;
- if ($wantv AND ($k < $this->n - 1)) {
- for ($i = 0; $i < $this->n; ++$i) {
- $t = $this->V[$i][$k+1];
- $this->V[$i][$k+1] = $this->V[$i][$k];
- $this->V[$i][$k] = $t;
- }
- }
- if ($wantu AND ($k < $this->m-1)) {
- for ($i = 0; $i < $this->m; ++$i) {
- $t = $this->U[$i][$k+1];
- $this->U[$i][$k+1] = $this->U[$i][$k];
- $this->U[$i][$k] = $t;
- }
- }
- ++$k;
- }
- $iter = 0;
- --$p;
- break;
- } // end switch
- } // end while
+ // Perform the task indicated by kase.
+ switch ($kase) {
+ // Deflate negligible s(p).
+ case 1:
+ $f = $e[$p-2];
+ $e[$p-2] = 0.0;
+ for ($j = $p - 2; $j >= $k; --$j) {
+ $t = hypo($this->s[$j],$f);
+ $cs = $this->s[$j] / $t;
+ $sn = $f / $t;
+ $this->s[$j] = $t;
+ if ($j != $k) {
+ $f = -$sn * $e[$j-1];
+ $e[$j-1] = $cs * $e[$j-1];
+ }
+ if ($wantv) {
+ for ($i = 0; $i < $this->n; ++$i) {
+ $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$p-1];
+ $this->V[$i][$p-1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$p-1];
+ $this->V[$i][$j] = $t;
+ }
+ }
+ }
+ break;
+ // Split at negligible s(k).
+ case 2:
+ $f = $e[$k-1];
+ $e[$k-1] = 0.0;
+ for ($j = $k; $j < $p; ++$j) {
+ $t = hypo($this->s[$j], $f);
+ $cs = $this->s[$j] / $t;
+ $sn = $f / $t;
+ $this->s[$j] = $t;
+ $f = -$sn * $e[$j];
+ $e[$j] = $cs * $e[$j];
+ if ($wantu) {
+ for ($i = 0; $i < $this->m; ++$i) {
+ $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$k-1];
+ $this->U[$i][$k-1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$k-1];
+ $this->U[$i][$j] = $t;
+ }
+ }
+ }
+ break;
+ // Perform one qr step.
+ case 3:
+ // Calculate the shift.
+ $scale = max(max(max(max(
+ abs($this->s[$p-1]),abs($this->s[$p-2])),abs($e[$p-2])),
+ abs($this->s[$k])), abs($e[$k]));
+ $sp = $this->s[$p-1] / $scale;
+ $spm1 = $this->s[$p-2] / $scale;
+ $epm1 = $e[$p-2] / $scale;
+ $sk = $this->s[$k] / $scale;
+ $ek = $e[$k] / $scale;
+ $b = (($spm1 + $sp) * ($spm1 - $sp) + $epm1 * $epm1) / 2.0;
+ $c = ($sp * $epm1) * ($sp * $epm1);
+ $shift = 0.0;
+ if (($b != 0.0) || ($c != 0.0)) {
+ $shift = sqrt($b * $b + $c);
+ if ($b < 0.0) {
+ $shift = -$shift;
+ }
+ $shift = $c / ($b + $shift);
+ }
+ $f = ($sk + $sp) * ($sk - $sp) + $shift;
+ $g = $sk * $ek;
+ // Chase zeros.
+ for ($j = $k; $j < $p-1; ++$j) {
+ $t = hypo($f,$g);
+ $cs = $f/$t;
+ $sn = $g/$t;
+ if ($j != $k) {
+ $e[$j-1] = $t;
+ }
+ $f = $cs * $this->s[$j] + $sn * $e[$j];
+ $e[$j] = $cs * $e[$j] - $sn * $this->s[$j];
+ $g = $sn * $this->s[$j+1];
+ $this->s[$j+1] = $cs * $this->s[$j+1];
+ if ($wantv) {
+ for ($i = 0; $i < $this->n; ++$i) {
+ $t = $cs * $this->V[$i][$j] + $sn * $this->V[$i][$j+1];
+ $this->V[$i][$j+1] = -$sn * $this->V[$i][$j] + $cs * $this->V[$i][$j+1];
+ $this->V[$i][$j] = $t;
+ }
+ }
+ $t = hypo($f,$g);
+ $cs = $f/$t;
+ $sn = $g/$t;
+ $this->s[$j] = $t;
+ $f = $cs * $e[$j] + $sn * $this->s[$j+1];
+ $this->s[$j+1] = -$sn * $e[$j] + $cs * $this->s[$j+1];
+ $g = $sn * $e[$j+1];
+ $e[$j+1] = $cs * $e[$j+1];
+ if ($wantu && ($j < $this->m - 1)) {
+ for ($i = 0; $i < $this->m; ++$i) {
+ $t = $cs * $this->U[$i][$j] + $sn * $this->U[$i][$j+1];
+ $this->U[$i][$j+1] = -$sn * $this->U[$i][$j] + $cs * $this->U[$i][$j+1];
+ $this->U[$i][$j] = $t;
+ }
+ }
+ }
+ $e[$p-2] = $f;
+ $iter = $iter + 1;
+ break;
+ // Convergence.
+ case 4:
+ // Make the singular values positive.
+ if ($this->s[$k] <= 0.0) {
+ $this->s[$k] = ($this->s[$k] < 0.0 ? -$this->s[$k] : 0.0);
+ if ($wantv) {
+ for ($i = 0; $i <= $pp; ++$i) {
+ $this->V[$i][$k] = -$this->V[$i][$k];
+ }
+ }
+ }
+ // Order the singular values.
+ while ($k < $pp) {
+ if ($this->s[$k] >= $this->s[$k+1]) {
+ break;
+ }
+ $t = $this->s[$k];
+ $this->s[$k] = $this->s[$k+1];
+ $this->s[$k+1] = $t;
+ if ($wantv AND ($k < $this->n - 1)) {
+ for ($i = 0; $i < $this->n; ++$i) {
+ $t = $this->V[$i][$k+1];
+ $this->V[$i][$k+1] = $this->V[$i][$k];
+ $this->V[$i][$k] = $t;
+ }
+ }
+ if ($wantu AND ($k < $this->m-1)) {
+ for ($i = 0; $i < $this->m; ++$i) {
+ $t = $this->U[$i][$k+1];
+ $this->U[$i][$k+1] = $this->U[$i][$k];
+ $this->U[$i][$k] = $t;
+ }
+ }
+ ++$k;
+ }
+ $iter = 0;
+ --$p;
+ break;
+ } // end switch
+ } // end while
- } // end constructor
+ } // end constructor
- /**
- * Return the left singular vectors
- *
- * @access public
- * @return U
- */
- public function getU() {
- return new Matrix($this->U, $this->m, min($this->m + 1, $this->n));
- }
+ /**
+ * Return the left singular vectors
+ *
+ * @access public
+ * @return U
+ */
+ public function getU() {
+ return new Matrix($this->U, $this->m, min($this->m + 1, $this->n));
+ }
- /**
- * Return the right singular vectors
- *
- * @access public
- * @return V
- */
- public function getV() {
- return new Matrix($this->V);
- }
+ /**
+ * Return the right singular vectors
+ *
+ * @access public
+ * @return V
+ */
+ public function getV() {
+ return new Matrix($this->V);
+ }
- /**
- * Return the one-dimensional array of singular values
- *
- * @access public
- * @return diagonal of S.
- */
- public function getSingularValues() {
- return $this->s;
- }
+ /**
+ * Return the one-dimensional array of singular values
+ *
+ * @access public
+ * @return diagonal of S.
+ */
+ public function getSingularValues() {
+ return $this->s;
+ }
- /**
- * Return the diagonal matrix of singular values
- *
- * @access public
- * @return S
- */
- public function getS() {
- for ($i = 0; $i < $this->n; ++$i) {
- for ($j = 0; $j < $this->n; ++$j) {
- $S[$i][$j] = 0.0;
- }
- $S[$i][$i] = $this->s[$i];
- }
- return new Matrix($S);
- }
+ /**
+ * Return the diagonal matrix of singular values
+ *
+ * @access public
+ * @return S
+ */
+ public function getS() {
+ for ($i = 0; $i < $this->n; ++$i) {
+ for ($j = 0; $j < $this->n; ++$j) {
+ $S[$i][$j] = 0.0;
+ }
+ $S[$i][$i] = $this->s[$i];
+ }
+ return new Matrix($S);
+ }
- /**
- * Two norm
- *
- * @access public
- * @return max(S)
- */
- public function norm2() {
- return $this->s[0];
- }
+ /**
+ * Two norm
+ *
+ * @access public
+ * @return max(S)
+ */
+ public function norm2() {
+ return $this->s[0];
+ }
- /**
- * Two norm condition number
- *
- * @access public
- * @return max(S)/min(S)
- */
- public function cond() {
- return $this->s[0] / $this->s[min($this->m, $this->n) - 1];
- }
+ /**
+ * Two norm condition number
+ *
+ * @access public
+ * @return max(S)/min(S)
+ */
+ public function cond() {
+ return $this->s[0] / $this->s[min($this->m, $this->n) - 1];
+ }
- /**
- * Effective numerical matrix rank
- *
- * @access public
- * @return Number of nonnegligible singular values.
- */
- public function rank() {
- $eps = pow(2.0, -52.0);
- $tol = max($this->m, $this->n) * $this->s[0] * $eps;
- $r = 0;
- for ($i = 0; $i < count($this->s); ++$i) {
- if ($this->s[$i] > $tol) {
- ++$r;
- }
- }
- return $r;
- }
+ /**
+ * Effective numerical matrix rank
+ *
+ * @access public
+ * @return Number of nonnegligible singular values.
+ */
+ public function rank() {
+ $eps = pow(2.0, -52.0);
+ $tol = max($this->m, $this->n) * $this->s[0] * $eps;
+ $r = 0;
+ for ($i = 0; $i < count($this->s); ++$i) {
+ if ($this->s[$i] > $tol) {
+ ++$r;
+ }
+ }
+ return $r;
+ }
-} // class SingularValueDecomposition
+} // class SingularValueDecomposition
diff --git a/Classes/PHPExcel/Shared/JAMA/utils/Error.php b/Classes/PHPExcel/Shared/JAMA/utils/Error.php
index e73252b3..ff51ccc5 100644
--- a/Classes/PHPExcel/Shared/JAMA/utils/Error.php
+++ b/Classes/PHPExcel/Shared/JAMA/utils/Error.php
@@ -1,10 +1,10 @@
abs($b)) {
- $r = $b / $a;
- $r = abs($a) * sqrt(1 + $r * $r);
- } elseif ($b != 0) {
- $r = $a / $b;
- $r = abs($b) * sqrt(1 + $r * $r);
- } else {
- $r = 0.0;
- }
- return $r;
-} // function hypo()
+ if (abs($a) > abs($b)) {
+ $r = $b / $a;
+ $r = abs($a) * sqrt(1 + $r * $r);
+ } elseif ($b != 0) {
+ $r = $a / $b;
+ $r = abs($b) * sqrt(1 + $r * $r);
+ } else {
+ $r = 0.0;
+ }
+ return $r;
+} // function hypo()
/**
- * Mike Bommarito's version.
- * Compute n-dimensional hyotheneuse.
+ * Mike Bommarito's version.
+ * Compute n-dimensional hyotheneuse.
*
function hypot() {
- $s = 0;
- foreach (func_get_args() as $d) {
- if (is_numeric($d)) {
- $s += pow($d, 2);
- } else {
- throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
- }
- }
- return sqrt($s);
+ $s = 0;
+ foreach (func_get_args() as $d) {
+ if (is_numeric($d)) {
+ $s += pow($d, 2);
+ } else {
+ throw new PHPExcel_Calculation_Exception(JAMAError(ArgumentTypeException));
+ }
+ }
+ return sqrt($s);
}
*/
diff --git a/Classes/PHPExcel/Shared/OLE.php b/Classes/PHPExcel/Shared/OLE.php
index 9796282a..f1149069 100644
--- a/Classes/PHPExcel/Shared/OLE.php
+++ b/Classes/PHPExcel/Shared/OLE.php
@@ -37,495 +37,495 @@ $GLOBALS['_OLE_INSTANCES'] = array();
*/
class PHPExcel_Shared_OLE
{
- const OLE_PPS_TYPE_ROOT = 5;
- const OLE_PPS_TYPE_DIR = 1;
- const OLE_PPS_TYPE_FILE = 2;
- const OLE_DATA_SIZE_SMALL = 0x1000;
- const OLE_LONG_INT_SIZE = 4;
- const OLE_PPS_SIZE = 0x80;
+ const OLE_PPS_TYPE_ROOT = 5;
+ const OLE_PPS_TYPE_DIR = 1;
+ const OLE_PPS_TYPE_FILE = 2;
+ const OLE_DATA_SIZE_SMALL = 0x1000;
+ const OLE_LONG_INT_SIZE = 4;
+ const OLE_PPS_SIZE = 0x80;
- /**
- * The file handle for reading an OLE container
- * @var resource
- */
- public $_file_handle;
+ /**
+ * The file handle for reading an OLE container
+ * @var resource
+ */
+ public $_file_handle;
- /**
- * Array of PPS's found on the OLE container
- * @var array
- */
- public $_list = array();
+ /**
+ * Array of PPS's found on the OLE container
+ * @var array
+ */
+ public $_list = array();
- /**
- * Root directory of OLE container
- * @var OLE_PPS_Root
- */
- public $root;
+ /**
+ * Root directory of OLE container
+ * @var OLE_PPS_Root
+ */
+ public $root;
- /**
- * Big Block Allocation Table
- * @var array (blockId => nextBlockId)
- */
- public $bbat;
+ /**
+ * Big Block Allocation Table
+ * @var array (blockId => nextBlockId)
+ */
+ public $bbat;
- /**
- * Short Block Allocation Table
- * @var array (blockId => nextBlockId)
- */
- public $sbat;
+ /**
+ * Short Block Allocation Table
+ * @var array (blockId => nextBlockId)
+ */
+ public $sbat;
- /**
- * Size of big blocks. This is usually 512.
- * @var int number of octets per block.
- */
- public $bigBlockSize;
+ /**
+ * Size of big blocks. This is usually 512.
+ * @var int number of octets per block.
+ */
+ public $bigBlockSize;
- /**
- * Size of small blocks. This is usually 64.
- * @var int number of octets per block
- */
- public $smallBlockSize;
+ /**
+ * Size of small blocks. This is usually 64.
+ * @var int number of octets per block
+ */
+ public $smallBlockSize;
- /**
- * Reads an OLE container from the contents of the file given.
- *
- * @acces public
- * @param string $file
- * @return mixed true on success, PEAR_Error on failure
- */
- public function read($file)
- {
- $fh = fopen($file, "r");
- if (!$fh) {
- throw new PHPExcel_Reader_Exception("Can't open file $file");
- }
- $this->_file_handle = $fh;
+ /**
+ * Reads an OLE container from the contents of the file given.
+ *
+ * @acces public
+ * @param string $file
+ * @return mixed true on success, PEAR_Error on failure
+ */
+ public function read($file)
+ {
+ $fh = fopen($file, "r");
+ if (!$fh) {
+ throw new PHPExcel_Reader_Exception("Can't open file $file");
+ }
+ $this->_file_handle = $fh;
- $signature = fread($fh, 8);
- if ("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" != $signature) {
- throw new PHPExcel_Reader_Exception("File doesn't seem to be an OLE container.");
- }
- fseek($fh, 28);
- if (fread($fh, 2) != "\xFE\xFF") {
- // This shouldn't be a problem in practice
- throw new PHPExcel_Reader_Exception("Only Little-Endian encoding is supported.");
- }
- // Size of blocks and short blocks in bytes
- $this->bigBlockSize = pow(2, self::_readInt2($fh));
- $this->smallBlockSize = pow(2, self::_readInt2($fh));
+ $signature = fread($fh, 8);
+ if ("\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" != $signature) {
+ throw new PHPExcel_Reader_Exception("File doesn't seem to be an OLE container.");
+ }
+ fseek($fh, 28);
+ if (fread($fh, 2) != "\xFE\xFF") {
+ // This shouldn't be a problem in practice
+ throw new PHPExcel_Reader_Exception("Only Little-Endian encoding is supported.");
+ }
+ // Size of blocks and short blocks in bytes
+ $this->bigBlockSize = pow(2, self::_readInt2($fh));
+ $this->smallBlockSize = pow(2, self::_readInt2($fh));
- // Skip UID, revision number and version number
- fseek($fh, 44);
- // Number of blocks in Big Block Allocation Table
- $bbatBlockCount = self::_readInt4($fh);
+ // Skip UID, revision number and version number
+ fseek($fh, 44);
+ // Number of blocks in Big Block Allocation Table
+ $bbatBlockCount = self::_readInt4($fh);
- // Root chain 1st block
- $directoryFirstBlockId = self::_readInt4($fh);
+ // Root chain 1st block
+ $directoryFirstBlockId = self::_readInt4($fh);
- // Skip unused bytes
- fseek($fh, 56);
- // Streams shorter than this are stored using small blocks
- $this->bigBlockThreshold = self::_readInt4($fh);
- // Block id of first sector in Short Block Allocation Table
- $sbatFirstBlockId = self::_readInt4($fh);
- // Number of blocks in Short Block Allocation Table
- $sbbatBlockCount = self::_readInt4($fh);
- // Block id of first sector in Master Block Allocation Table
- $mbatFirstBlockId = self::_readInt4($fh);
- // Number of blocks in Master Block Allocation Table
- $mbbatBlockCount = self::_readInt4($fh);
- $this->bbat = array();
+ // Skip unused bytes
+ fseek($fh, 56);
+ // Streams shorter than this are stored using small blocks
+ $this->bigBlockThreshold = self::_readInt4($fh);
+ // Block id of first sector in Short Block Allocation Table
+ $sbatFirstBlockId = self::_readInt4($fh);
+ // Number of blocks in Short Block Allocation Table
+ $sbbatBlockCount = self::_readInt4($fh);
+ // Block id of first sector in Master Block Allocation Table
+ $mbatFirstBlockId = self::_readInt4($fh);
+ // Number of blocks in Master Block Allocation Table
+ $mbbatBlockCount = self::_readInt4($fh);
+ $this->bbat = array();
- // Remaining 4 * 109 bytes of current block is beginning of Master
- // Block Allocation Table
- $mbatBlocks = array();
- for ($i = 0; $i < 109; ++$i) {
- $mbatBlocks[] = self::_readInt4($fh);
- }
+ // Remaining 4 * 109 bytes of current block is beginning of Master
+ // Block Allocation Table
+ $mbatBlocks = array();
+ for ($i = 0; $i < 109; ++$i) {
+ $mbatBlocks[] = self::_readInt4($fh);
+ }
- // Read rest of Master Block Allocation Table (if any is left)
- $pos = $this->_getBlockOffset($mbatFirstBlockId);
- for ($i = 0; $i < $mbbatBlockCount; ++$i) {
- fseek($fh, $pos);
- for ($j = 0; $j < $this->bigBlockSize / 4 - 1; ++$j) {
- $mbatBlocks[] = self::_readInt4($fh);
- }
- // Last block id in each block points to next block
- $pos = $this->_getBlockOffset(self::_readInt4($fh));
- }
+ // Read rest of Master Block Allocation Table (if any is left)
+ $pos = $this->_getBlockOffset($mbatFirstBlockId);
+ for ($i = 0; $i < $mbbatBlockCount; ++$i) {
+ fseek($fh, $pos);
+ for ($j = 0; $j < $this->bigBlockSize / 4 - 1; ++$j) {
+ $mbatBlocks[] = self::_readInt4($fh);
+ }
+ // Last block id in each block points to next block
+ $pos = $this->_getBlockOffset(self::_readInt4($fh));
+ }
- // Read Big Block Allocation Table according to chain specified by
- // $mbatBlocks
- for ($i = 0; $i < $bbatBlockCount; ++$i) {
- $pos = $this->_getBlockOffset($mbatBlocks[$i]);
- fseek($fh, $pos);
- for ($j = 0 ; $j < $this->bigBlockSize / 4; ++$j) {
- $this->bbat[] = self::_readInt4($fh);
- }
- }
+ // Read Big Block Allocation Table according to chain specified by
+ // $mbatBlocks
+ for ($i = 0; $i < $bbatBlockCount; ++$i) {
+ $pos = $this->_getBlockOffset($mbatBlocks[$i]);
+ fseek($fh, $pos);
+ for ($j = 0 ; $j < $this->bigBlockSize / 4; ++$j) {
+ $this->bbat[] = self::_readInt4($fh);
+ }
+ }
- // Read short block allocation table (SBAT)
- $this->sbat = array();
- $shortBlockCount = $sbbatBlockCount * $this->bigBlockSize / 4;
- $sbatFh = $this->getStream($sbatFirstBlockId);
- for ($blockId = 0; $blockId < $shortBlockCount; ++$blockId) {
- $this->sbat[$blockId] = self::_readInt4($sbatFh);
- }
- fclose($sbatFh);
+ // Read short block allocation table (SBAT)
+ $this->sbat = array();
+ $shortBlockCount = $sbbatBlockCount * $this->bigBlockSize / 4;
+ $sbatFh = $this->getStream($sbatFirstBlockId);
+ for ($blockId = 0; $blockId < $shortBlockCount; ++$blockId) {
+ $this->sbat[$blockId] = self::_readInt4($sbatFh);
+ }
+ fclose($sbatFh);
- $this->_readPpsWks($directoryFirstBlockId);
+ $this->_readPpsWks($directoryFirstBlockId);
- return true;
- }
+ return true;
+ }
- /**
- * @param int block id
- * @param int byte offset from beginning of file
- * @access public
- */
- public function _getBlockOffset($blockId)
- {
- return 512 + $blockId * $this->bigBlockSize;
- }
+ /**
+ * @param int block id
+ * @param int byte offset from beginning of file
+ * @access public
+ */
+ public function _getBlockOffset($blockId)
+ {
+ return 512 + $blockId * $this->bigBlockSize;
+ }
- /**
- * Returns a stream for use with fread() etc. External callers should
- * use PHPExcel_Shared_OLE_PPS_File::getStream().
- * @param int|PPS block id or PPS
- * @return resource read-only stream
- */
- public function getStream($blockIdOrPps)
- {
- static $isRegistered = false;
- if (!$isRegistered) {
- stream_wrapper_register('ole-chainedblockstream',
- 'PHPExcel_Shared_OLE_ChainedBlockStream');
- $isRegistered = true;
- }
+ /**
+ * Returns a stream for use with fread() etc. External callers should
+ * use PHPExcel_Shared_OLE_PPS_File::getStream().
+ * @param int|PPS block id or PPS
+ * @return resource read-only stream
+ */
+ public function getStream($blockIdOrPps)
+ {
+ static $isRegistered = false;
+ if (!$isRegistered) {
+ stream_wrapper_register('ole-chainedblockstream',
+ 'PHPExcel_Shared_OLE_ChainedBlockStream');
+ $isRegistered = true;
+ }
- // Store current instance in global array, so that it can be accessed
- // in OLE_ChainedBlockStream::stream_open().
- // Object is removed from self::$instances in OLE_Stream::close().
- $GLOBALS['_OLE_INSTANCES'][] = $this;
- $instanceId = end(array_keys($GLOBALS['_OLE_INSTANCES']));
+ // Store current instance in global array, so that it can be accessed
+ // in OLE_ChainedBlockStream::stream_open().
+ // Object is removed from self::$instances in OLE_Stream::close().
+ $GLOBALS['_OLE_INSTANCES'][] = $this;
+ $instanceId = end(array_keys($GLOBALS['_OLE_INSTANCES']));
- $path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId;
- if ($blockIdOrPps instanceof PHPExcel_Shared_OLE_PPS) {
- $path .= '&blockId=' . $blockIdOrPps->_StartBlock;
- $path .= '&size=' . $blockIdOrPps->Size;
- } else {
- $path .= '&blockId=' . $blockIdOrPps;
- }
- return fopen($path, 'r');
- }
+ $path = 'ole-chainedblockstream://oleInstanceId=' . $instanceId;
+ if ($blockIdOrPps instanceof PHPExcel_Shared_OLE_PPS) {
+ $path .= '&blockId=' . $blockIdOrPps->_StartBlock;
+ $path .= '&size=' . $blockIdOrPps->Size;
+ } else {
+ $path .= '&blockId=' . $blockIdOrPps;
+ }
+ return fopen($path, 'r');
+ }
- /**
- * Reads a signed char.
- * @param resource file handle
- * @return int
- * @access public
- */
- private static function _readInt1($fh)
- {
- list(, $tmp) = unpack("c", fread($fh, 1));
- return $tmp;
- }
+ /**
+ * Reads a signed char.
+ * @param resource file handle
+ * @return int
+ * @access public
+ */
+ private static function _readInt1($fh)
+ {
+ list(, $tmp) = unpack("c", fread($fh, 1));
+ return $tmp;
+ }
- /**
- * Reads an unsigned short (2 octets).
- * @param resource file handle
- * @return int
- * @access public
- */
- private static function _readInt2($fh)
- {
- list(, $tmp) = unpack("v", fread($fh, 2));
- return $tmp;
- }
+ /**
+ * Reads an unsigned short (2 octets).
+ * @param resource file handle
+ * @return int
+ * @access public
+ */
+ private static function _readInt2($fh)
+ {
+ list(, $tmp) = unpack("v", fread($fh, 2));
+ return $tmp;
+ }
- /**
- * Reads an unsigned long (4 octets).
- * @param resource file handle
- * @return int
- * @access public
- */
- private static function _readInt4($fh)
- {
- list(, $tmp) = unpack("V", fread($fh, 4));
- return $tmp;
- }
+ /**
+ * Reads an unsigned long (4 octets).
+ * @param resource file handle
+ * @return int
+ * @access public
+ */
+ private static function _readInt4($fh)
+ {
+ list(, $tmp) = unpack("V", fread($fh, 4));
+ return $tmp;
+ }
- /**
- * Gets information about all PPS's on the OLE container from the PPS WK's
- * creates an OLE_PPS object for each one.
- *
- * @access public
- * @param integer the block id of the first block
- * @return mixed true on success, PEAR_Error on failure
- */
- public function _readPpsWks($blockId)
- {
- $fh = $this->getStream($blockId);
- for ($pos = 0; ; $pos += 128) {
- fseek($fh, $pos, SEEK_SET);
- $nameUtf16 = fread($fh, 64);
- $nameLength = self::_readInt2($fh);
- $nameUtf16 = substr($nameUtf16, 0, $nameLength - 2);
- // Simple conversion from UTF-16LE to ISO-8859-1
- $name = str_replace("\x00", "", $nameUtf16);
- $type = self::_readInt1($fh);
- switch ($type) {
- case self::OLE_PPS_TYPE_ROOT:
- $pps = new PHPExcel_Shared_OLE_PPS_Root(null, null, array());
- $this->root = $pps;
- break;
- case self::OLE_PPS_TYPE_DIR:
- $pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null,
- null, null, null, null, array());
- break;
- case self::OLE_PPS_TYPE_FILE:
- $pps = new PHPExcel_Shared_OLE_PPS_File($name);
- break;
- default:
- continue;
- }
- fseek($fh, 1, SEEK_CUR);
- $pps->Type = $type;
- $pps->Name = $name;
- $pps->PrevPps = self::_readInt4($fh);
- $pps->NextPps = self::_readInt4($fh);
- $pps->DirPps = self::_readInt4($fh);
- fseek($fh, 20, SEEK_CUR);
- $pps->Time1st = self::OLE2LocalDate(fread($fh, 8));
- $pps->Time2nd = self::OLE2LocalDate(fread($fh, 8));
- $pps->_StartBlock = self::_readInt4($fh);
- $pps->Size = self::_readInt4($fh);
- $pps->No = count($this->_list);
- $this->_list[] = $pps;
+ /**
+ * Gets information about all PPS's on the OLE container from the PPS WK's
+ * creates an OLE_PPS object for each one.
+ *
+ * @access public
+ * @param integer the block id of the first block
+ * @return mixed true on success, PEAR_Error on failure
+ */
+ public function _readPpsWks($blockId)
+ {
+ $fh = $this->getStream($blockId);
+ for ($pos = 0; ; $pos += 128) {
+ fseek($fh, $pos, SEEK_SET);
+ $nameUtf16 = fread($fh, 64);
+ $nameLength = self::_readInt2($fh);
+ $nameUtf16 = substr($nameUtf16, 0, $nameLength - 2);
+ // Simple conversion from UTF-16LE to ISO-8859-1
+ $name = str_replace("\x00", "", $nameUtf16);
+ $type = self::_readInt1($fh);
+ switch ($type) {
+ case self::OLE_PPS_TYPE_ROOT:
+ $pps = new PHPExcel_Shared_OLE_PPS_Root(null, null, array());
+ $this->root = $pps;
+ break;
+ case self::OLE_PPS_TYPE_DIR:
+ $pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null,
+ null, null, null, null, array());
+ break;
+ case self::OLE_PPS_TYPE_FILE:
+ $pps = new PHPExcel_Shared_OLE_PPS_File($name);
+ break;
+ default:
+ continue;
+ }
+ fseek($fh, 1, SEEK_CUR);
+ $pps->Type = $type;
+ $pps->Name = $name;
+ $pps->PrevPps = self::_readInt4($fh);
+ $pps->NextPps = self::_readInt4($fh);
+ $pps->DirPps = self::_readInt4($fh);
+ fseek($fh, 20, SEEK_CUR);
+ $pps->Time1st = self::OLE2LocalDate(fread($fh, 8));
+ $pps->Time2nd = self::OLE2LocalDate(fread($fh, 8));
+ $pps->_StartBlock = self::_readInt4($fh);
+ $pps->Size = self::_readInt4($fh);
+ $pps->No = count($this->_list);
+ $this->_list[] = $pps;
- // check if the PPS tree (starting from root) is complete
- if (isset($this->root) &&
- $this->_ppsTreeComplete($this->root->No)) {
+ // check if the PPS tree (starting from root) is complete
+ if (isset($this->root) &&
+ $this->_ppsTreeComplete($this->root->No)) {
- break;
- }
- }
- fclose($fh);
+ break;
+ }
+ }
+ fclose($fh);
- // Initialize $pps->children on directories
- foreach ($this->_list as $pps) {
- if ($pps->Type == self::OLE_PPS_TYPE_DIR || $pps->Type == self::OLE_PPS_TYPE_ROOT) {
- $nos = array($pps->DirPps);
- $pps->children = array();
- while ($nos) {
- $no = array_pop($nos);
- if ($no != -1) {
- $childPps = $this->_list[$no];
- $nos[] = $childPps->PrevPps;
- $nos[] = $childPps->NextPps;
- $pps->children[] = $childPps;
- }
- }
- }
- }
+ // Initialize $pps->children on directories
+ foreach ($this->_list as $pps) {
+ if ($pps->Type == self::OLE_PPS_TYPE_DIR || $pps->Type == self::OLE_PPS_TYPE_ROOT) {
+ $nos = array($pps->DirPps);
+ $pps->children = array();
+ while ($nos) {
+ $no = array_pop($nos);
+ if ($no != -1) {
+ $childPps = $this->_list[$no];
+ $nos[] = $childPps->PrevPps;
+ $nos[] = $childPps->NextPps;
+ $pps->children[] = $childPps;
+ }
+ }
+ }
+ }
- return true;
- }
+ return true;
+ }
- /**
- * It checks whether the PPS tree is complete (all PPS's read)
- * starting with the given PPS (not necessarily root)
- *
- * @access public
- * @param integer $index The index of the PPS from which we are checking
- * @return boolean Whether the PPS tree for the given PPS is complete
- */
- public function _ppsTreeComplete($index)
- {
- return isset($this->_list[$index]) &&
- ($pps = $this->_list[$index]) &&
- ($pps->PrevPps == -1 ||
- $this->_ppsTreeComplete($pps->PrevPps)) &&
- ($pps->NextPps == -1 ||
- $this->_ppsTreeComplete($pps->NextPps)) &&
- ($pps->DirPps == -1 ||
- $this->_ppsTreeComplete($pps->DirPps));
- }
+ /**
+ * It checks whether the PPS tree is complete (all PPS's read)
+ * starting with the given PPS (not necessarily root)
+ *
+ * @access public
+ * @param integer $index The index of the PPS from which we are checking
+ * @return boolean Whether the PPS tree for the given PPS is complete
+ */
+ public function _ppsTreeComplete($index)
+ {
+ return isset($this->_list[$index]) &&
+ ($pps = $this->_list[$index]) &&
+ ($pps->PrevPps == -1 ||
+ $this->_ppsTreeComplete($pps->PrevPps)) &&
+ ($pps->NextPps == -1 ||
+ $this->_ppsTreeComplete($pps->NextPps)) &&
+ ($pps->DirPps == -1 ||
+ $this->_ppsTreeComplete($pps->DirPps));
+ }
- /**
- * Checks whether a PPS is a File PPS or not.
- * If there is no PPS for the index given, it will return false.
- *
- * @access public
- * @param integer $index The index for the PPS
- * @return bool true if it's a File PPS, false otherwise
- */
- public function isFile($index)
- {
- if (isset($this->_list[$index])) {
- return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_FILE);
- }
- return false;
- }
+ /**
+ * Checks whether a PPS is a File PPS or not.
+ * If there is no PPS for the index given, it will return false.
+ *
+ * @access public
+ * @param integer $index The index for the PPS
+ * @return bool true if it's a File PPS, false otherwise
+ */
+ public function isFile($index)
+ {
+ if (isset($this->_list[$index])) {
+ return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_FILE);
+ }
+ return false;
+ }
- /**
- * Checks whether a PPS is a Root PPS or not.
- * If there is no PPS for the index given, it will return false.
- *
- * @access public
- * @param integer $index The index for the PPS.
- * @return bool true if it's a Root PPS, false otherwise
- */
- public function isRoot($index)
- {
- if (isset($this->_list[$index])) {
- return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_ROOT);
- }
- return false;
- }
+ /**
+ * Checks whether a PPS is a Root PPS or not.
+ * If there is no PPS for the index given, it will return false.
+ *
+ * @access public
+ * @param integer $index The index for the PPS.
+ * @return bool true if it's a Root PPS, false otherwise
+ */
+ public function isRoot($index)
+ {
+ if (isset($this->_list[$index])) {
+ return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_ROOT);
+ }
+ return false;
+ }
- /**
- * Gives the total number of PPS's found in the OLE container.
- *
- * @access public
- * @return integer The total number of PPS's found in the OLE container
- */
- public function ppsTotal()
- {
- return count($this->_list);
- }
+ /**
+ * Gives the total number of PPS's found in the OLE container.
+ *
+ * @access public
+ * @return integer The total number of PPS's found in the OLE container
+ */
+ public function ppsTotal()
+ {
+ return count($this->_list);
+ }
- /**
- * Gets data from a PPS
- * If there is no PPS for the index given, it will return an empty string.
- *
- * @access public
- * @param integer $index The index for the PPS
- * @param integer $position The position from which to start reading
- * (relative to the PPS)
- * @param integer $length The amount of bytes to read (at most)
- * @return string The binary string containing the data requested
- * @see OLE_PPS_File::getStream()
- */
- public function getData($index, $position, $length)
- {
- // if position is not valid return empty string
- if (!isset($this->_list[$index]) || ($position >= $this->_list[$index]->Size) || ($position < 0)) {
- return '';
- }
- $fh = $this->getStream($this->_list[$index]);
- $data = stream_get_contents($fh, $length, $position);
- fclose($fh);
- return $data;
- }
+ /**
+ * Gets data from a PPS
+ * If there is no PPS for the index given, it will return an empty string.
+ *
+ * @access public
+ * @param integer $index The index for the PPS
+ * @param integer $position The position from which to start reading
+ * (relative to the PPS)
+ * @param integer $length The amount of bytes to read (at most)
+ * @return string The binary string containing the data requested
+ * @see OLE_PPS_File::getStream()
+ */
+ public function getData($index, $position, $length)
+ {
+ // if position is not valid return empty string
+ if (!isset($this->_list[$index]) || ($position >= $this->_list[$index]->Size) || ($position < 0)) {
+ return '';
+ }
+ $fh = $this->getStream($this->_list[$index]);
+ $data = stream_get_contents($fh, $length, $position);
+ fclose($fh);
+ return $data;
+ }
- /**
- * Gets the data length from a PPS
- * If there is no PPS for the index given, it will return 0.
- *
- * @access public
- * @param integer $index The index for the PPS
- * @return integer The amount of bytes in data the PPS has
- */
- public function getDataLength($index)
- {
- if (isset($this->_list[$index])) {
- return $this->_list[$index]->Size;
- }
- return 0;
- }
+ /**
+ * Gets the data length from a PPS
+ * If there is no PPS for the index given, it will return 0.
+ *
+ * @access public
+ * @param integer $index The index for the PPS
+ * @return integer The amount of bytes in data the PPS has
+ */
+ public function getDataLength($index)
+ {
+ if (isset($this->_list[$index])) {
+ return $this->_list[$index]->Size;
+ }
+ return 0;
+ }
- /**
- * Utility function to transform ASCII text to Unicode
- *
- * @access public
- * @static
- * @param string $ascii The ASCII string to transform
- * @return string The string in Unicode
- */
- public static function Asc2Ucs($ascii)
- {
- $rawname = '';
- for ($i = 0; $i < strlen($ascii); ++$i) {
- $rawname .= $ascii{$i} . "\x00";
- }
- return $rawname;
- }
+ /**
+ * Utility function to transform ASCII text to Unicode
+ *
+ * @access public
+ * @static
+ * @param string $ascii The ASCII string to transform
+ * @return string The string in Unicode
+ */
+ public static function Asc2Ucs($ascii)
+ {
+ $rawname = '';
+ for ($i = 0; $i < strlen($ascii); ++$i) {
+ $rawname .= $ascii{$i} . "\x00";
+ }
+ return $rawname;
+ }
- /**
- * Utility function
- * Returns a string for the OLE container with the date given
- *
- * @access public
- * @static
- * @param integer $date A timestamp
- * @return string The string for the OLE container
- */
- public static function LocalDate2OLE($date = null)
- {
- if (!isset($date)) {
- return "\x00\x00\x00\x00\x00\x00\x00\x00";
- }
+ /**
+ * Utility function
+ * Returns a string for the OLE container with the date given
+ *
+ * @access public
+ * @static
+ * @param integer $date A timestamp
+ * @return string The string for the OLE container
+ */
+ public static function LocalDate2OLE($date = null)
+ {
+ if (!isset($date)) {
+ return "\x00\x00\x00\x00\x00\x00\x00\x00";
+ }
- // factor used for separating numbers into 4 bytes parts
- $factor = pow(2, 32);
+ // factor used for separating numbers into 4 bytes parts
+ $factor = pow(2, 32);
- // days from 1-1-1601 until the beggining of UNIX era
- $days = 134774;
- // calculate seconds
- $big_date = $days*24*3600 + gmmktime(date("H",$date),date("i",$date),date("s",$date),
- date("m",$date),date("d",$date),date("Y",$date));
- // multiply just to make MS happy
- $big_date *= 10000000;
+ // days from 1-1-1601 until the beggining of UNIX era
+ $days = 134774;
+ // calculate seconds
+ $big_date = $days*24*3600 + gmmktime(date("H",$date),date("i",$date),date("s",$date),
+ date("m",$date),date("d",$date),date("Y",$date));
+ // multiply just to make MS happy
+ $big_date *= 10000000;
- $high_part = floor($big_date / $factor);
- // lower 4 bytes
- $low_part = floor((($big_date / $factor) - $high_part) * $factor);
+ $high_part = floor($big_date / $factor);
+ // lower 4 bytes
+ $low_part = floor((($big_date / $factor) - $high_part) * $factor);
- // Make HEX string
- $res = '';
+ // Make HEX string
+ $res = '';
- for ($i = 0; $i < 4; ++$i) {
- $hex = $low_part % 0x100;
- $res .= pack('c', $hex);
- $low_part /= 0x100;
- }
- for ($i = 0; $i < 4; ++$i) {
- $hex = $high_part % 0x100;
- $res .= pack('c', $hex);
- $high_part /= 0x100;
- }
- return $res;
- }
+ for ($i = 0; $i < 4; ++$i) {
+ $hex = $low_part % 0x100;
+ $res .= pack('c', $hex);
+ $low_part /= 0x100;
+ }
+ for ($i = 0; $i < 4; ++$i) {
+ $hex = $high_part % 0x100;
+ $res .= pack('c', $hex);
+ $high_part /= 0x100;
+ }
+ return $res;
+ }
- /**
- * Returns a timestamp from an OLE container's date
- *
- * @access public
- * @static
- * @param integer $string A binary string with the encoded date
- * @return string The timestamp corresponding to the string
- */
- public static function OLE2LocalDate($string)
- {
- if (strlen($string) != 8) {
- return new PEAR_Error("Expecting 8 byte string");
- }
+ /**
+ * Returns a timestamp from an OLE container's date
+ *
+ * @access public
+ * @static
+ * @param integer $string A binary string with the encoded date
+ * @return string The timestamp corresponding to the string
+ */
+ public static function OLE2LocalDate($string)
+ {
+ if (strlen($string) != 8) {
+ return new PEAR_Error("Expecting 8 byte string");
+ }
- // factor used for separating numbers into 4 bytes parts
- $factor = pow(2,32);
- list(, $high_part) = unpack('V', substr($string, 4, 4));
- list(, $low_part) = unpack('V', substr($string, 0, 4));
+ // factor used for separating numbers into 4 bytes parts
+ $factor = pow(2,32);
+ list(, $high_part) = unpack('V', substr($string, 4, 4));
+ list(, $low_part) = unpack('V', substr($string, 0, 4));
- $big_date = ($high_part * $factor) + $low_part;
- // translate to seconds
- $big_date /= 10000000;
+ $big_date = ($high_part * $factor) + $low_part;
+ // translate to seconds
+ $big_date /= 10000000;
- // days from 1-1-1601 until the beggining of UNIX era
- $days = 134774;
+ // days from 1-1-1601 until the beggining of UNIX era
+ $days = 134774;
- // translate to seconds from beggining of UNIX era
- $big_date -= $days * 24 * 3600;
- return floor($big_date);
- }
+ // translate to seconds from beggining of UNIX era
+ $big_date -= $days * 24 * 3600;
+ return floor($big_date);
+ }
}
diff --git a/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php b/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php
index 03a9e48f..10f3f4b4 100644
--- a/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php
+++ b/Classes/PHPExcel/Shared/OLE/ChainedBlockStream.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Shared_OLE
* @copyright Copyright (c) 2006 - 2007 Christian Schmidt
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
@@ -37,186 +37,186 @@
*/
class PHPExcel_Shared_OLE_ChainedBlockStream
{
- /**
- * The OLE container of the file that is being read.
- * @var OLE
- */
- public $ole;
+ /**
+ * The OLE container of the file that is being read.
+ * @var OLE
+ */
+ public $ole;
- /**
- * Parameters specified by fopen().
- * @var array
- */
- public $params;
+ /**
+ * Parameters specified by fopen().
+ * @var array
+ */
+ public $params;
- /**
- * The binary data of the file.
- * @var string
- */
- public $data;
+ /**
+ * The binary data of the file.
+ * @var string
+ */
+ public $data;
- /**
- * The file pointer.
- * @var int byte offset
- */
- public $pos;
+ /**
+ * The file pointer.
+ * @var int byte offset
+ */
+ public $pos;
- /**
- * Implements support for fopen().
- * For creating streams using this wrapper, use OLE_PPS_File::getStream().
- *
- * @param string $path resource name including scheme, e.g.
- * ole-chainedblockstream://oleInstanceId=1
- * @param string $mode only "r" is supported
- * @param int $options mask of STREAM_REPORT_ERRORS and STREAM_USE_PATH
- * @param string &$openedPath absolute path of the opened stream (out parameter)
- * @return bool true on success
- */
- public function stream_open($path, $mode, $options, &$openedPath)
- {
- if ($mode != 'r') {
- if ($options & STREAM_REPORT_ERRORS) {
- trigger_error('Only reading is supported', E_USER_WARNING);
- }
- return false;
- }
+ /**
+ * Implements support for fopen().
+ * For creating streams using this wrapper, use OLE_PPS_File::getStream().
+ *
+ * @param string $path resource name including scheme, e.g.
+ * ole-chainedblockstream://oleInstanceId=1
+ * @param string $mode only "r" is supported
+ * @param int $options mask of STREAM_REPORT_ERRORS and STREAM_USE_PATH
+ * @param string &$openedPath absolute path of the opened stream (out parameter)
+ * @return bool true on success
+ */
+ public function stream_open($path, $mode, $options, &$openedPath)
+ {
+ if ($mode != 'r') {
+ if ($options & STREAM_REPORT_ERRORS) {
+ trigger_error('Only reading is supported', E_USER_WARNING);
+ }
+ return false;
+ }
- // 25 is length of "ole-chainedblockstream://"
- parse_str(substr($path, 25), $this->params);
- if (!isset($this->params['oleInstanceId'],
- $this->params['blockId'],
- $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']])) {
+ // 25 is length of "ole-chainedblockstream://"
+ parse_str(substr($path, 25), $this->params);
+ if (!isset($this->params['oleInstanceId'],
+ $this->params['blockId'],
+ $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']])) {
- if ($options & STREAM_REPORT_ERRORS) {
- trigger_error('OLE stream not found', E_USER_WARNING);
- }
- return false;
- }
- $this->ole = $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']];
+ if ($options & STREAM_REPORT_ERRORS) {
+ trigger_error('OLE stream not found', E_USER_WARNING);
+ }
+ return false;
+ }
+ $this->ole = $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']];
- $blockId = $this->params['blockId'];
- $this->data = '';
- if (isset($this->params['size']) &&
- $this->params['size'] < $this->ole->bigBlockThreshold &&
- $blockId != $this->ole->root->_StartBlock) {
+ $blockId = $this->params['blockId'];
+ $this->data = '';
+ if (isset($this->params['size']) &&
+ $this->params['size'] < $this->ole->bigBlockThreshold &&
+ $blockId != $this->ole->root->_StartBlock) {
- // Block id refers to small blocks
- $rootPos = $this->ole->_getBlockOffset($this->ole->root->_StartBlock);
- while ($blockId != -2) {
- $pos = $rootPos + $blockId * $this->ole->bigBlockSize;
- $blockId = $this->ole->sbat[$blockId];
- fseek($this->ole->_file_handle, $pos);
- $this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize);
- }
- } else {
- // Block id refers to big blocks
- while ($blockId != -2) {
- $pos = $this->ole->_getBlockOffset($blockId);
- fseek($this->ole->_file_handle, $pos);
- $this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize);
- $blockId = $this->ole->bbat[$blockId];
- }
- }
- if (isset($this->params['size'])) {
- $this->data = substr($this->data, 0, $this->params['size']);
- }
+ // Block id refers to small blocks
+ $rootPos = $this->ole->_getBlockOffset($this->ole->root->_StartBlock);
+ while ($blockId != -2) {
+ $pos = $rootPos + $blockId * $this->ole->bigBlockSize;
+ $blockId = $this->ole->sbat[$blockId];
+ fseek($this->ole->_file_handle, $pos);
+ $this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize);
+ }
+ } else {
+ // Block id refers to big blocks
+ while ($blockId != -2) {
+ $pos = $this->ole->_getBlockOffset($blockId);
+ fseek($this->ole->_file_handle, $pos);
+ $this->data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize);
+ $blockId = $this->ole->bbat[$blockId];
+ }
+ }
+ if (isset($this->params['size'])) {
+ $this->data = substr($this->data, 0, $this->params['size']);
+ }
- if ($options & STREAM_USE_PATH) {
- $openedPath = $path;
- }
+ if ($options & STREAM_USE_PATH) {
+ $openedPath = $path;
+ }
- return true;
- }
+ return true;
+ }
- /**
- * Implements support for fclose().
- *
- */
- public function stream_close()
- {
- $this->ole = null;
- unset($GLOBALS['_OLE_INSTANCES']);
- }
+ /**
+ * Implements support for fclose().
+ *
+ */
+ public function stream_close()
+ {
+ $this->ole = null;
+ unset($GLOBALS['_OLE_INSTANCES']);
+ }
- /**
- * Implements support for fread(), fgets() etc.
- *
- * @param int $count maximum number of bytes to read
- * @return string
- */
- public function stream_read($count)
- {
- if ($this->stream_eof()) {
- return false;
- }
- $s = substr($this->data, $this->pos, $count);
- $this->pos += $count;
- return $s;
- }
+ /**
+ * Implements support for fread(), fgets() etc.
+ *
+ * @param int $count maximum number of bytes to read
+ * @return string
+ */
+ public function stream_read($count)
+ {
+ if ($this->stream_eof()) {
+ return false;
+ }
+ $s = substr($this->data, $this->pos, $count);
+ $this->pos += $count;
+ return $s;
+ }
- /**
- * Implements support for feof().
- *
- * @return bool TRUE if the file pointer is at EOF; otherwise FALSE
- */
- public function stream_eof()
- {
- return $this->pos >= strlen($this->data);
- }
+ /**
+ * Implements support for feof().
+ *
+ * @return bool TRUE if the file pointer is at EOF; otherwise FALSE
+ */
+ public function stream_eof()
+ {
+ return $this->pos >= strlen($this->data);
+ }
- /**
- * Returns the position of the file pointer, i.e. its offset into the file
- * stream. Implements support for ftell().
- *
- * @return int
- */
- public function stream_tell()
- {
- return $this->pos;
- }
+ /**
+ * Returns the position of the file pointer, i.e. its offset into the file
+ * stream. Implements support for ftell().
+ *
+ * @return int
+ */
+ public function stream_tell()
+ {
+ return $this->pos;
+ }
- /**
- * Implements support for fseek().
- *
- * @param int $offset byte offset
- * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END
- * @return bool
- */
- public function stream_seek($offset, $whence)
- {
- if ($whence == SEEK_SET && $offset >= 0) {
- $this->pos = $offset;
- } elseif ($whence == SEEK_CUR && -$offset <= $this->pos) {
- $this->pos += $offset;
- } elseif ($whence == SEEK_END && -$offset <= sizeof($this->data)) {
- $this->pos = strlen($this->data) + $offset;
- } else {
- return false;
- }
- return true;
- }
+ /**
+ * Implements support for fseek().
+ *
+ * @param int $offset byte offset
+ * @param int $whence SEEK_SET, SEEK_CUR or SEEK_END
+ * @return bool
+ */
+ public function stream_seek($offset, $whence)
+ {
+ if ($whence == SEEK_SET && $offset >= 0) {
+ $this->pos = $offset;
+ } elseif ($whence == SEEK_CUR && -$offset <= $this->pos) {
+ $this->pos += $offset;
+ } elseif ($whence == SEEK_END && -$offset <= sizeof($this->data)) {
+ $this->pos = strlen($this->data) + $offset;
+ } else {
+ return false;
+ }
+ return true;
+ }
- /**
- * Implements support for fstat(). Currently the only supported field is
- * "size".
- * @return array
- */
- public function stream_stat()
- {
- return array(
- 'size' => strlen($this->data),
- );
- }
+ /**
+ * Implements support for fstat(). Currently the only supported field is
+ * "size".
+ * @return array
+ */
+ public function stream_stat()
+ {
+ return array(
+ 'size' => strlen($this->data),
+ );
+ }
- // Methods used by stream_wrapper_register() that are not implemented:
- // bool stream_flush ( void )
- // int stream_write ( string data )
- // bool rename ( string path_from, string path_to )
- // bool mkdir ( string path, int mode, int options )
- // bool rmdir ( string path, int options )
- // bool dir_opendir ( string path, int options )
- // array url_stat ( string path, int flags )
- // string dir_readdir ( void )
- // bool dir_rewinddir ( void )
- // bool dir_closedir ( void )
+ // Methods used by stream_wrapper_register() that are not implemented:
+ // bool stream_flush ( void )
+ // int stream_write ( string data )
+ // bool rename ( string path_from, string path_to )
+ // bool mkdir ( string path, int mode, int options )
+ // bool rmdir ( string path, int options )
+ // bool dir_opendir ( string path, int options )
+ // array url_stat ( string path, int flags )
+ // string dir_readdir ( void )
+ // bool dir_rewinddir ( void )
+ // bool dir_closedir ( void )
}
diff --git a/Classes/PHPExcel/Shared/OLE/PPS.php b/Classes/PHPExcel/Shared/OLE/PPS.php
index 4db0ae4e..80875f90 100644
--- a/Classes/PHPExcel/Shared/OLE/PPS.php
+++ b/Classes/PHPExcel/Shared/OLE/PPS.php
@@ -29,202 +29,202 @@
*/
class PHPExcel_Shared_OLE_PPS
{
- /**
- * The PPS index
- * @var integer
- */
- public $No;
+ /**
+ * The PPS index
+ * @var integer
+ */
+ public $No;
- /**
- * The PPS name (in Unicode)
- * @var string
- */
- public $Name;
+ /**
+ * The PPS name (in Unicode)
+ * @var string
+ */
+ public $Name;
- /**
- * The PPS type. Dir, Root or File
- * @var integer
- */
- public $Type;
+ /**
+ * The PPS type. Dir, Root or File
+ * @var integer
+ */
+ public $Type;
- /**
- * The index of the previous PPS
- * @var integer
- */
- public $PrevPps;
+ /**
+ * The index of the previous PPS
+ * @var integer
+ */
+ public $PrevPps;
- /**
- * The index of the next PPS
- * @var integer
- */
- public $NextPps;
+ /**
+ * The index of the next PPS
+ * @var integer
+ */
+ public $NextPps;
- /**
- * The index of it's first child if this is a Dir or Root PPS
- * @var integer
- */
- public $DirPps;
+ /**
+ * The index of it's first child if this is a Dir or Root PPS
+ * @var integer
+ */
+ public $DirPps;
- /**
- * A timestamp
- * @var integer
- */
- public $Time1st;
+ /**
+ * A timestamp
+ * @var integer
+ */
+ public $Time1st;
- /**
- * A timestamp
- * @var integer
- */
- public $Time2nd;
+ /**
+ * A timestamp
+ * @var integer
+ */
+ public $Time2nd;
- /**
- * Starting block (small or big) for this PPS's data inside the container
- * @var integer
- */
- public $_StartBlock;
+ /**
+ * Starting block (small or big) for this PPS's data inside the container
+ * @var integer
+ */
+ public $_StartBlock;
- /**
- * The size of the PPS's data (in bytes)
- * @var integer
- */
- public $Size;
+ /**
+ * The size of the PPS's data (in bytes)
+ * @var integer
+ */
+ public $Size;
- /**
- * The PPS's data (only used if it's not using a temporary file)
- * @var string
- */
- public $_data;
+ /**
+ * The PPS's data (only used if it's not using a temporary file)
+ * @var string
+ */
+ public $_data;
- /**
- * Array of child PPS's (only used by Root and Dir PPS's)
- * @var array
- */
- public $children = array();
+ /**
+ * Array of child PPS's (only used by Root and Dir PPS's)
+ * @var array
+ */
+ public $children = array();
- /**
- * Pointer to OLE container
- * @var OLE
- */
- public $ole;
+ /**
+ * Pointer to OLE container
+ * @var OLE
+ */
+ public $ole;
- /**
- * The constructor
- *
- * @access public
- * @param integer $No The PPS index
- * @param string $name The PPS name
- * @param integer $type The PPS type. Dir, Root or File
- * @param integer $prev The index of the previous PPS
- * @param integer $next The index of the next PPS
- * @param integer $dir The index of it's first child if this is a Dir or Root PPS
- * @param integer $time_1st A timestamp
- * @param integer $time_2nd A timestamp
- * @param string $data The (usually binary) source data of the PPS
- * @param array $children Array containing children PPS for this PPS
- */
- public function __construct($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children)
- {
- $this->No = $No;
- $this->Name = $name;
- $this->Type = $type;
- $this->PrevPps = $prev;
- $this->NextPps = $next;
- $this->DirPps = $dir;
- $this->Time1st = $time_1st;
- $this->Time2nd = $time_2nd;
- $this->_data = $data;
- $this->children = $children;
- if ($data != '') {
- $this->Size = strlen($data);
- } else {
- $this->Size = 0;
- }
- }
+ /**
+ * The constructor
+ *
+ * @access public
+ * @param integer $No The PPS index
+ * @param string $name The PPS name
+ * @param integer $type The PPS type. Dir, Root or File
+ * @param integer $prev The index of the previous PPS
+ * @param integer $next The index of the next PPS
+ * @param integer $dir The index of it's first child if this is a Dir or Root PPS
+ * @param integer $time_1st A timestamp
+ * @param integer $time_2nd A timestamp
+ * @param string $data The (usually binary) source data of the PPS
+ * @param array $children Array containing children PPS for this PPS
+ */
+ public function __construct($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children)
+ {
+ $this->No = $No;
+ $this->Name = $name;
+ $this->Type = $type;
+ $this->PrevPps = $prev;
+ $this->NextPps = $next;
+ $this->DirPps = $dir;
+ $this->Time1st = $time_1st;
+ $this->Time2nd = $time_2nd;
+ $this->_data = $data;
+ $this->children = $children;
+ if ($data != '') {
+ $this->Size = strlen($data);
+ } else {
+ $this->Size = 0;
+ }
+ }
- /**
- * Returns the amount of data saved for this PPS
- *
- * @access public
- * @return integer The amount of data (in bytes)
- */
- public function _DataLen()
- {
- if (!isset($this->_data)) {
- return 0;
- }
- //if (isset($this->_PPS_FILE)) {
- // fseek($this->_PPS_FILE, 0);
- // $stats = fstat($this->_PPS_FILE);
- // return $stats[7];
- //} else {
- return strlen($this->_data);
- //}
- }
+ /**
+ * Returns the amount of data saved for this PPS
+ *
+ * @access public
+ * @return integer The amount of data (in bytes)
+ */
+ public function _DataLen()
+ {
+ if (!isset($this->_data)) {
+ return 0;
+ }
+ //if (isset($this->_PPS_FILE)) {
+ // fseek($this->_PPS_FILE, 0);
+ // $stats = fstat($this->_PPS_FILE);
+ // return $stats[7];
+ //} else {
+ return strlen($this->_data);
+ //}
+ }
- /**
- * Returns a string with the PPS's WK (What is a WK?)
- *
- * @access public
- * @return string The binary string
- */
- public function _getPpsWk()
- {
- $ret = str_pad($this->Name,64,"\x00");
+ /**
+ * Returns a string with the PPS's WK (What is a WK?)
+ *
+ * @access public
+ * @return string The binary string
+ */
+ public function _getPpsWk()
+ {
+ $ret = str_pad($this->Name,64,"\x00");
- $ret .= pack("v", strlen($this->Name) + 2) // 66
- . pack("c", $this->Type) // 67
- . pack("c", 0x00) //UK // 68
- . pack("V", $this->PrevPps) //Prev // 72
- . pack("V", $this->NextPps) //Next // 76
- . pack("V", $this->DirPps) //Dir // 80
- . "\x00\x09\x02\x00" // 84
- . "\x00\x00\x00\x00" // 88
- . "\xc0\x00\x00\x00" // 92
- . "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root
- . "\x00\x00\x00\x00" // 100
- . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time1st) // 108
- . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time2nd) // 116
- . pack("V", isset($this->_StartBlock)?
- $this->_StartBlock:0) // 120
- . pack("V", $this->Size) // 124
- . pack("V", 0); // 128
- return $ret;
- }
+ $ret .= pack("v", strlen($this->Name) + 2) // 66
+ . pack("c", $this->Type) // 67
+ . pack("c", 0x00) //UK // 68
+ . pack("V", $this->PrevPps) //Prev // 72
+ . pack("V", $this->NextPps) //Next // 76
+ . pack("V", $this->DirPps) //Dir // 80
+ . "\x00\x09\x02\x00" // 84
+ . "\x00\x00\x00\x00" // 88
+ . "\xc0\x00\x00\x00" // 92
+ . "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root
+ . "\x00\x00\x00\x00" // 100
+ . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time1st) // 108
+ . PHPExcel_Shared_OLE::LocalDate2OLE($this->Time2nd) // 116
+ . pack("V", isset($this->_StartBlock)?
+ $this->_StartBlock:0) // 120
+ . pack("V", $this->Size) // 124
+ . pack("V", 0); // 128
+ return $ret;
+ }
- /**
- * Updates index and pointers to previous, next and children PPS's for this
- * PPS. I don't think it'll work with Dir PPS's.
- *
- * @access public
- * @param array &$raList Reference to the array of PPS's for the whole OLE
- * container
- * @return integer The index for this PPS
- */
- public static function _savePpsSetPnt(&$raList, $to_save, $depth = 0)
- {
- if ( !is_array($to_save) || (empty($to_save)) ) {
- return 0xFFFFFFFF;
- } elseif( count($to_save) == 1 ) {
- $cnt = count($raList);
- // If the first entry, it's the root... Don't clone it!
- $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 {
- $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++);
+ /**
+ * Updates index and pointers to previous, next and children PPS's for this
+ * PPS. I don't think it'll work with Dir PPS's.
+ *
+ * @access public
+ * @param array &$raList Reference to the array of PPS's for the whole OLE
+ * container
+ * @return integer The index for this PPS
+ */
+ public static function _savePpsSetPnt(&$raList, $to_save, $depth = 0)
+ {
+ if ( !is_array($to_save) || (empty($to_save)) ) {
+ return 0xFFFFFFFF;
+ } elseif( count($to_save) == 1 ) {
+ $cnt = count($raList);
+ // If the first entry, it's the root... Don't clone it!
+ $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 {
+ $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 $cnt;
- }
+ }
+ return $cnt;
+ }
}
diff --git a/Classes/PHPExcel/Shared/OLE/PPS/File.php b/Classes/PHPExcel/Shared/OLE/PPS/File.php
index f061f568..f0be587a 100644
--- a/Classes/PHPExcel/Shared/OLE/PPS/File.php
+++ b/Classes/PHPExcel/Shared/OLE/PPS/File.php
@@ -28,57 +28,57 @@
* @package PHPExcel_Shared_OLE
*/
class PHPExcel_Shared_OLE_PPS_File extends PHPExcel_Shared_OLE_PPS
- {
- /**
- * The constructor
- *
- * @access public
- * @param string $name The name of the file (in Unicode)
- * @see OLE::Asc2Ucs()
- */
- public function __construct($name)
- {
- parent::__construct(
- null,
- $name,
- PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE,
- null,
- null,
- null,
- null,
- null,
- '',
- array());
- }
+ {
+ /**
+ * The constructor
+ *
+ * @access public
+ * @param string $name The name of the file (in Unicode)
+ * @see OLE::Asc2Ucs()
+ */
+ public function __construct($name)
+ {
+ parent::__construct(
+ null,
+ $name,
+ PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE,
+ null,
+ null,
+ null,
+ null,
+ null,
+ '',
+ array());
+ }
- /**
- * Initialization method. Has to be called right after OLE_PPS_File().
- *
- * @access public
- * @return mixed true on success
- */
- public function init()
- {
- return true;
- }
+ /**
+ * Initialization method. Has to be called right after OLE_PPS_File().
+ *
+ * @access public
+ * @return mixed true on success
+ */
+ public function init()
+ {
+ return true;
+ }
- /**
- * Append data to PPS
- *
- * @access public
- * @param string $data The data to append
- */
- public function append($data)
- {
- $this->_data .= $data;
- }
+ /**
+ * Append data to PPS
+ *
+ * @access public
+ * @param string $data The data to append
+ */
+ public function append($data)
+ {
+ $this->_data .= $data;
+ }
- /**
- * Returns a stream for reading this file using fread() etc.
- * @return resource a read-only stream
- */
- public function getStream()
- {
- $this->ole->getStream($this);
- }
+ /**
+ * Returns a stream for reading this file using fread() etc.
+ * @return resource a read-only stream
+ */
+ public function getStream()
+ {
+ $this->ole->getStream($this);
+ }
}
diff --git a/Classes/PHPExcel/Shared/OLE/PPS/Root.php b/Classes/PHPExcel/Shared/OLE/PPS/Root.php
index eb929d20..cbf01105 100644
--- a/Classes/PHPExcel/Shared/OLE/PPS/Root.php
+++ b/Classes/PHPExcel/Shared/OLE/PPS/Root.php
@@ -28,440 +28,440 @@
* @package PHPExcel_Shared_OLE
*/
class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
- {
+ {
- /**
- * Directory for temporary files
- * @var string
- */
- protected $_tmp_dir = NULL;
+ /**
+ * Directory for temporary files
+ * @var string
+ */
+ protected $_tmp_dir = NULL;
- /**
- * @param integer $time_1st A timestamp
- * @param integer $time_2nd A timestamp
- */
- public function __construct($time_1st, $time_2nd, $raChild)
- {
- $this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir();
+ /**
+ * @param integer $time_1st A timestamp
+ * @param integer $time_2nd A timestamp
+ */
+ public function __construct($time_1st, $time_2nd, $raChild)
+ {
+ $this->_tempDir = PHPExcel_Shared_File::sys_get_temp_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);
- }
+ 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);
+ }
- /**
- * 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));
+ /**
+ * 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);
+ 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);
+ // 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);
+ // 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_);
- }
+ if (!is_resource($filename)) {
+ fclose($this->_FILEH_);
+ }
- return true;
- }
+ return true;
+ }
- /**
- * Calculate some numbers
- *
- * @access public
- * @param array $raList Reference to an array of PPS's
- * @return array The array of numbers
- */
- public function _calcSize(&$raList)
- {
- // Calculate Basic Setting
- list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0,0,0);
- $iSmallLen = 0;
- $iSBcnt = 0;
- $iCount = count($raList);
- for ($i = 0; $i < $iCount; ++$i) {
- if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) {
- $raList[$i]->Size = $raList[$i]->_DataLen();
- if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) {
- $iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
- + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
- } else {
- $iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
- (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
- }
- }
- }
- $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE;
- $iSlCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE);
- $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt)? 1:0);
- $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) +
- (( $iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0));
- $iCnt = count($raList);
- $iBdCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
- $iPPScnt = (floor($iCnt/$iBdCnt) + (($iCnt % $iBdCnt)? 1: 0));
+ /**
+ * Calculate some numbers
+ *
+ * @access public
+ * @param array $raList Reference to an array of PPS's
+ * @return array The array of numbers
+ */
+ public function _calcSize(&$raList)
+ {
+ // Calculate Basic Setting
+ list($iSBDcnt, $iBBcnt, $iPPScnt) = array(0,0,0);
+ $iSmallLen = 0;
+ $iSBcnt = 0;
+ $iCount = count($raList);
+ for ($i = 0; $i < $iCount; ++$i) {
+ if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) {
+ $raList[$i]->Size = $raList[$i]->_DataLen();
+ if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) {
+ $iSBcnt += floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
+ + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
+ } else {
+ $iBBcnt += (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
+ (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
+ }
+ }
+ }
+ $iSmallLen = $iSBcnt * $this->_SMALL_BLOCK_SIZE;
+ $iSlCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE);
+ $iSBDcnt = floor($iSBcnt / $iSlCnt) + (($iSBcnt % $iSlCnt)? 1:0);
+ $iBBcnt += (floor($iSmallLen / $this->_BIG_BLOCK_SIZE) +
+ (( $iSmallLen % $this->_BIG_BLOCK_SIZE)? 1: 0));
+ $iCnt = count($raList);
+ $iBdCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
+ $iPPScnt = (floor($iCnt/$iBdCnt) + (($iCnt % $iBdCnt)? 1: 0));
- return array($iSBDcnt, $iBBcnt, $iPPScnt);
- }
+ return array($iSBDcnt, $iBBcnt, $iPPScnt);
+ }
- /**
- * Helper function for caculating a magic value for block sizes
- *
- * @access public
- * @param integer $i2 The argument
- * @see save()
- * @return integer
- */
- private static function _adjust2($i2)
- {
- $iWk = log($i2)/log(2);
- return ($iWk > floor($iWk))? floor($iWk)+1:$iWk;
- }
+ /**
+ * Helper function for caculating a magic value for block sizes
+ *
+ * @access public
+ * @param integer $i2 The argument
+ * @see save()
+ * @return integer
+ */
+ private static function _adjust2($i2)
+ {
+ $iWk = log($i2)/log(2);
+ return ($iWk > floor($iWk))? floor($iWk)+1:$iWk;
+ }
- /**
- * Save OLE header
- *
- * @access public
- * @param integer $iSBDcnt
- * @param integer $iBBcnt
- * @param integer $iPPScnt
- */
- public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt)
- {
- $FILE = $this->_FILEH_;
+ /**
+ * Save OLE header
+ *
+ * @access public
+ * @param integer $iSBDcnt
+ * @param integer $iBBcnt
+ * @param integer $iPPScnt
+ */
+ public function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt)
+ {
+ $FILE = $this->_FILEH_;
- // Calculate Basic Setting
- $iBlCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
- $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
+ // Calculate Basic Setting
+ $iBlCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
+ $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
- $iBdExL = 0;
- $iAll = $iBBcnt + $iPPScnt + $iSBDcnt;
- $iAllW = $iAll;
- $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
- $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
+ $iBdExL = 0;
+ $iAll = $iBBcnt + $iPPScnt + $iSBDcnt;
+ $iAllW = $iAll;
+ $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
+ $iBdCnt = floor(($iAll + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
- // Calculate BD count
- if ($iBdCnt > $i1stBdL) {
- while (1) {
- ++$iBdExL;
- ++$iAllW;
- $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
- $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
- if ($iBdCnt <= ($iBdExL*$iBlCnt+ $i1stBdL)) {
- break;
- }
- }
- }
+ // Calculate BD count
+ if ($iBdCnt > $i1stBdL) {
+ while (1) {
+ ++$iBdExL;
+ ++$iAllW;
+ $iBdCntW = floor($iAllW / $iBlCnt) + (($iAllW % $iBlCnt)? 1: 0);
+ $iBdCnt = floor(($iAllW + $iBdCntW) / $iBlCnt) + ((($iAllW+$iBdCntW) % $iBlCnt)? 1: 0);
+ if ($iBdCnt <= ($iBdExL*$iBlCnt+ $i1stBdL)) {
+ break;
+ }
+ }
+ }
- // Save Header
- fwrite($FILE,
- "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
- . "\x00\x00\x00\x00"
- . "\x00\x00\x00\x00"
- . "\x00\x00\x00\x00"
- . "\x00\x00\x00\x00"
- . pack("v", 0x3b)
- . pack("v", 0x03)
- . pack("v", -2)
- . pack("v", 9)
- . pack("v", 6)
- . pack("v", 0)
- . "\x00\x00\x00\x00"
- . "\x00\x00\x00\x00"
- . pack("V", $iBdCnt)
- . pack("V", $iBBcnt+$iSBDcnt) //ROOT START
- . pack("V", 0)
- . pack("V", 0x1000)
- . pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot
- . pack("V", $iSBDcnt)
- );
- // Extra BDList Start, Count
- if ($iBdCnt < $i1stBdL) {
- fwrite($FILE,
- pack("V", -2) // Extra BDList Start
- . pack("V", 0) // Extra BDList Count
- );
- } else {
- fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL));
- }
+ // Save Header
+ fwrite($FILE,
+ "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"
+ . "\x00\x00\x00\x00"
+ . "\x00\x00\x00\x00"
+ . "\x00\x00\x00\x00"
+ . "\x00\x00\x00\x00"
+ . pack("v", 0x3b)
+ . pack("v", 0x03)
+ . pack("v", -2)
+ . pack("v", 9)
+ . pack("v", 6)
+ . pack("v", 0)
+ . "\x00\x00\x00\x00"
+ . "\x00\x00\x00\x00"
+ . pack("V", $iBdCnt)
+ . pack("V", $iBBcnt+$iSBDcnt) //ROOT START
+ . pack("V", 0)
+ . pack("V", 0x1000)
+ . pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot
+ . pack("V", $iSBDcnt)
+ );
+ // Extra BDList Start, Count
+ if ($iBdCnt < $i1stBdL) {
+ fwrite($FILE,
+ pack("V", -2) // Extra BDList Start
+ . pack("V", 0) // Extra BDList Count
+ );
+ } else {
+ fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL));
+ }
- // BDList
- for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; ++$i) {
- fwrite($FILE, pack("V", $iAll+$i));
- }
- if ($i < $i1stBdL) {
- $jB = $i1stBdL - $i;
- for ($j = 0; $j < $jB; ++$j) {
- fwrite($FILE, (pack("V", -1)));
- }
- }
- }
+ // BDList
+ for ($i = 0; $i < $i1stBdL && $i < $iBdCnt; ++$i) {
+ fwrite($FILE, pack("V", $iAll+$i));
+ }
+ if ($i < $i1stBdL) {
+ $jB = $i1stBdL - $i;
+ for ($j = 0; $j < $jB; ++$j) {
+ fwrite($FILE, (pack("V", -1)));
+ }
+ }
+ }
- /**
- * Saving big data (PPS's with data bigger than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL)
- *
- * @access public
- * @param integer $iStBlk
- * @param array &$raList Reference to array of PPS's
- */
- public function _saveBigData($iStBlk, &$raList)
- {
- $FILE = $this->_FILEH_;
+ /**
+ * Saving big data (PPS's with data bigger than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL)
+ *
+ * @access public
+ * @param integer $iStBlk
+ * @param array &$raList Reference to array of PPS's
+ */
+ public function _saveBigData($iStBlk, &$raList)
+ {
+ $FILE = $this->_FILEH_;
- // cycle through PPS's
- $iCount = count($raList);
- for ($i = 0; $i < $iCount; ++$i) {
- if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) {
- $raList[$i]->Size = $raList[$i]->_DataLen();
- if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) ||
- (($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data)))
- {
- // Write Data
- //if (isset($raList[$i]->_PPS_FILE)) {
- // $iLen = 0;
- // fseek($raList[$i]->_PPS_FILE, 0); // To The Top
- // while($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
- // $iLen += strlen($sBuff);
- // fwrite($FILE, $sBuff);
- // }
- //} else {
- fwrite($FILE, $raList[$i]->_data);
- //}
+ // cycle through PPS's
+ $iCount = count($raList);
+ for ($i = 0; $i < $iCount; ++$i) {
+ if ($raList[$i]->Type != PHPExcel_Shared_OLE::OLE_PPS_TYPE_DIR) {
+ $raList[$i]->Size = $raList[$i]->_DataLen();
+ if (($raList[$i]->Size >= PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) ||
+ (($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_ROOT) && isset($raList[$i]->_data)))
+ {
+ // Write Data
+ //if (isset($raList[$i]->_PPS_FILE)) {
+ // $iLen = 0;
+ // fseek($raList[$i]->_PPS_FILE, 0); // To The Top
+ // while($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
+ // $iLen += strlen($sBuff);
+ // fwrite($FILE, $sBuff);
+ // }
+ //} else {
+ fwrite($FILE, $raList[$i]->_data);
+ //}
- if ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) {
- fwrite($FILE, str_repeat("\x00", $this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)));
- }
- // Set For PPS
- $raList[$i]->_StartBlock = $iStBlk;
- $iStBlk +=
- (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
- (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
- }
- // Close file for each PPS, and unlink it
- //if (isset($raList[$i]->_PPS_FILE)) {
- // fclose($raList[$i]->_PPS_FILE);
- // $raList[$i]->_PPS_FILE = null;
- // unlink($raList[$i]->_tmp_filename);
- //}
- }
- }
- }
+ if ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE) {
+ fwrite($FILE, str_repeat("\x00", $this->_BIG_BLOCK_SIZE - ($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)));
+ }
+ // Set For PPS
+ $raList[$i]->_StartBlock = $iStBlk;
+ $iStBlk +=
+ (floor($raList[$i]->Size / $this->_BIG_BLOCK_SIZE) +
+ (($raList[$i]->Size % $this->_BIG_BLOCK_SIZE)? 1: 0));
+ }
+ // Close file for each PPS, and unlink it
+ //if (isset($raList[$i]->_PPS_FILE)) {
+ // fclose($raList[$i]->_PPS_FILE);
+ // $raList[$i]->_PPS_FILE = null;
+ // unlink($raList[$i]->_tmp_filename);
+ //}
+ }
+ }
+ }
- /**
- * get small data (PPS's with data smaller than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL)
- *
- * @access public
- * @param array &$raList Reference to array of PPS's
- */
- public function _makeSmallData(&$raList)
- {
- $sRes = '';
- $FILE = $this->_FILEH_;
- $iSmBlk = 0;
+ /**
+ * get small data (PPS's with data smaller than PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL)
+ *
+ * @access public
+ * @param array &$raList Reference to array of PPS's
+ */
+ public function _makeSmallData(&$raList)
+ {
+ $sRes = '';
+ $FILE = $this->_FILEH_;
+ $iSmBlk = 0;
- $iCount = count($raList);
- for ($i = 0; $i < $iCount; ++$i) {
- // Make SBD, small data string
- if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) {
- if ($raList[$i]->Size <= 0) {
- continue;
- }
- if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) {
- $iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
- + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
- // Add to SBD
- $jB = $iSmbCnt - 1;
- for ($j = 0; $j < $jB; ++$j) {
- fwrite($FILE, pack("V", $j+$iSmBlk+1));
- }
- fwrite($FILE, pack("V", -2));
+ $iCount = count($raList);
+ for ($i = 0; $i < $iCount; ++$i) {
+ // Make SBD, small data string
+ if ($raList[$i]->Type == PHPExcel_Shared_OLE::OLE_PPS_TYPE_FILE) {
+ if ($raList[$i]->Size <= 0) {
+ continue;
+ }
+ if ($raList[$i]->Size < PHPExcel_Shared_OLE::OLE_DATA_SIZE_SMALL) {
+ $iSmbCnt = floor($raList[$i]->Size / $this->_SMALL_BLOCK_SIZE)
+ + (($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE)? 1: 0);
+ // Add to SBD
+ $jB = $iSmbCnt - 1;
+ for ($j = 0; $j < $jB; ++$j) {
+ fwrite($FILE, pack("V", $j+$iSmBlk+1));
+ }
+ fwrite($FILE, pack("V", -2));
- //// Add to Data String(this will be written for RootEntry)
- //if ($raList[$i]->_PPS_FILE) {
- // fseek($raList[$i]->_PPS_FILE, 0); // To The Top
- // while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
- // $sRes .= $sBuff;
- // }
- //} else {
- $sRes .= $raList[$i]->_data;
- //}
- if ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) {
- $sRes .= str_repeat("\x00",$this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE));
- }
- // Set for PPS
- $raList[$i]->_StartBlock = $iSmBlk;
- $iSmBlk += $iSmbCnt;
- }
- }
- }
- $iSbCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE);
- if ($iSmBlk % $iSbCnt) {
- $iB = $iSbCnt - ($iSmBlk % $iSbCnt);
- for ($i = 0; $i < $iB; ++$i) {
- fwrite($FILE, pack("V", -1));
- }
- }
- return $sRes;
- }
+ //// Add to Data String(this will be written for RootEntry)
+ //if ($raList[$i]->_PPS_FILE) {
+ // fseek($raList[$i]->_PPS_FILE, 0); // To The Top
+ // while ($sBuff = fread($raList[$i]->_PPS_FILE, 4096)) {
+ // $sRes .= $sBuff;
+ // }
+ //} else {
+ $sRes .= $raList[$i]->_data;
+ //}
+ if ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE) {
+ $sRes .= str_repeat("\x00",$this->_SMALL_BLOCK_SIZE - ($raList[$i]->Size % $this->_SMALL_BLOCK_SIZE));
+ }
+ // Set for PPS
+ $raList[$i]->_StartBlock = $iSmBlk;
+ $iSmBlk += $iSmbCnt;
+ }
+ }
+ }
+ $iSbCnt = floor($this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE);
+ if ($iSmBlk % $iSbCnt) {
+ $iB = $iSbCnt - ($iSmBlk % $iSbCnt);
+ for ($i = 0; $i < $iB; ++$i) {
+ fwrite($FILE, pack("V", -1));
+ }
+ }
+ return $sRes;
+ }
- /**
- * Saves all the PPS's WKs
- *
- * @access public
- * @param array $raList Reference to an array with all PPS's
- */
- public function _savePps(&$raList)
- {
- // Save each PPS WK
- $iC = count($raList);
- for ($i = 0; $i < $iC; ++$i) {
- fwrite($this->_FILEH_, $raList[$i]->_getPpsWk());
- }
- // Adjust for Block
- $iCnt = count($raList);
- $iBCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
- if ($iCnt % $iBCnt) {
- fwrite($this->_FILEH_, str_repeat("\x00",($iBCnt - ($iCnt % $iBCnt)) * PHPExcel_Shared_OLE::OLE_PPS_SIZE));
- }
- }
+ /**
+ * Saves all the PPS's WKs
+ *
+ * @access public
+ * @param array $raList Reference to an array with all PPS's
+ */
+ public function _savePps(&$raList)
+ {
+ // Save each PPS WK
+ $iC = count($raList);
+ for ($i = 0; $i < $iC; ++$i) {
+ fwrite($this->_FILEH_, $raList[$i]->_getPpsWk());
+ }
+ // Adjust for Block
+ $iCnt = count($raList);
+ $iBCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_PPS_SIZE;
+ if ($iCnt % $iBCnt) {
+ fwrite($this->_FILEH_, str_repeat("\x00",($iBCnt - ($iCnt % $iBCnt)) * PHPExcel_Shared_OLE::OLE_PPS_SIZE));
+ }
+ }
- /**
- * Saving Big Block Depot
- *
- * @access public
- * @param integer $iSbdSize
- * @param integer $iBsize
- * @param integer $iPpsCnt
- */
- public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt)
- {
- $FILE = $this->_FILEH_;
- // Calculate Basic Setting
- $iBbCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
- $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
+ /**
+ * Saving Big Block Depot
+ *
+ * @access public
+ * @param integer $iSbdSize
+ * @param integer $iBsize
+ * @param integer $iPpsCnt
+ */
+ public function _saveBbd($iSbdSize, $iBsize, $iPpsCnt)
+ {
+ $FILE = $this->_FILEH_;
+ // Calculate Basic Setting
+ $iBbCnt = $this->_BIG_BLOCK_SIZE / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
+ $i1stBdL = ($this->_BIG_BLOCK_SIZE - 0x4C) / PHPExcel_Shared_OLE::OLE_LONG_INT_SIZE;
- $iBdExL = 0;
- $iAll = $iBsize + $iPpsCnt + $iSbdSize;
- $iAllW = $iAll;
- $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
- $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
- // Calculate BD count
- if ($iBdCnt >$i1stBdL) {
- while (1) {
- ++$iBdExL;
- ++$iAllW;
- $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
- $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
- if ($iBdCnt <= ($iBdExL*$iBbCnt+ $i1stBdL)) {
- break;
- }
- }
- }
+ $iBdExL = 0;
+ $iAll = $iBsize + $iPpsCnt + $iSbdSize;
+ $iAllW = $iAll;
+ $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
+ $iBdCnt = floor(($iAll + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
+ // Calculate BD count
+ if ($iBdCnt >$i1stBdL) {
+ while (1) {
+ ++$iBdExL;
+ ++$iAllW;
+ $iBdCntW = floor($iAllW / $iBbCnt) + (($iAllW % $iBbCnt)? 1: 0);
+ $iBdCnt = floor(($iAllW + $iBdCntW) / $iBbCnt) + ((($iAllW+$iBdCntW) % $iBbCnt)? 1: 0);
+ if ($iBdCnt <= ($iBdExL*$iBbCnt+ $i1stBdL)) {
+ break;
+ }
+ }
+ }
- // Making BD
- // Set for SBD
- if ($iSbdSize > 0) {
- for ($i = 0; $i < ($iSbdSize - 1); ++$i) {
- fwrite($FILE, pack("V", $i+1));
- }
- fwrite($FILE, pack("V", -2));
- }
- // Set for B
- for ($i = 0; $i < ($iBsize - 1); ++$i) {
- fwrite($FILE, pack("V", $i+$iSbdSize+1));
- }
- fwrite($FILE, pack("V", -2));
+ // Making BD
+ // Set for SBD
+ if ($iSbdSize > 0) {
+ for ($i = 0; $i < ($iSbdSize - 1); ++$i) {
+ fwrite($FILE, pack("V", $i+1));
+ }
+ fwrite($FILE, pack("V", -2));
+ }
+ // Set for B
+ for ($i = 0; $i < ($iBsize - 1); ++$i) {
+ fwrite($FILE, pack("V", $i+$iSbdSize+1));
+ }
+ fwrite($FILE, pack("V", -2));
- // Set for PPS
- for ($i = 0; $i < ($iPpsCnt - 1); ++$i) {
- fwrite($FILE, pack("V", $i+$iSbdSize+$iBsize+1));
- }
- fwrite($FILE, pack("V", -2));
- // Set for BBD itself ( 0xFFFFFFFD : BBD)
- for ($i = 0; $i < $iBdCnt; ++$i) {
- fwrite($FILE, pack("V", 0xFFFFFFFD));
- }
- // Set for ExtraBDList
- for ($i = 0; $i < $iBdExL; ++$i) {
- fwrite($FILE, pack("V", 0xFFFFFFFC));
- }
- // Adjust for Block
- if (($iAllW + $iBdCnt) % $iBbCnt) {
- $iBlock = ($iBbCnt - (($iAllW + $iBdCnt) % $iBbCnt));
- for ($i = 0; $i < $iBlock; ++$i) {
- fwrite($FILE, pack("V", -1));
- }
- }
- // Extra BDList
- if ($iBdCnt > $i1stBdL) {
- $iN=0;
- $iNb=0;
- for ($i = $i1stBdL;$i < $iBdCnt; $i++, ++$iN) {
- if ($iN >= ($iBbCnt - 1)) {
- $iN = 0;
- ++$iNb;
- fwrite($FILE, pack("V", $iAll+$iBdCnt+$iNb));
- }
- fwrite($FILE, pack("V", $iBsize+$iSbdSize+$iPpsCnt+$i));
- }
- if (($iBdCnt-$i1stBdL) % ($iBbCnt-1)) {
- $iB = ($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1));
- for ($i = 0; $i < $iB; ++$i) {
- fwrite($FILE, pack("V", -1));
- }
- }
- fwrite($FILE, pack("V", -2));
- }
- }
+ // Set for PPS
+ for ($i = 0; $i < ($iPpsCnt - 1); ++$i) {
+ fwrite($FILE, pack("V", $i+$iSbdSize+$iBsize+1));
+ }
+ fwrite($FILE, pack("V", -2));
+ // Set for BBD itself ( 0xFFFFFFFD : BBD)
+ for ($i = 0; $i < $iBdCnt; ++$i) {
+ fwrite($FILE, pack("V", 0xFFFFFFFD));
+ }
+ // Set for ExtraBDList
+ for ($i = 0; $i < $iBdExL; ++$i) {
+ fwrite($FILE, pack("V", 0xFFFFFFFC));
+ }
+ // Adjust for Block
+ if (($iAllW + $iBdCnt) % $iBbCnt) {
+ $iBlock = ($iBbCnt - (($iAllW + $iBdCnt) % $iBbCnt));
+ for ($i = 0; $i < $iBlock; ++$i) {
+ fwrite($FILE, pack("V", -1));
+ }
+ }
+ // Extra BDList
+ if ($iBdCnt > $i1stBdL) {
+ $iN=0;
+ $iNb=0;
+ for ($i = $i1stBdL;$i < $iBdCnt; $i++, ++$iN) {
+ if ($iN >= ($iBbCnt - 1)) {
+ $iN = 0;
+ ++$iNb;
+ fwrite($FILE, pack("V", $iAll+$iBdCnt+$iNb));
+ }
+ fwrite($FILE, pack("V", $iBsize+$iSbdSize+$iPpsCnt+$i));
+ }
+ if (($iBdCnt-$i1stBdL) % ($iBbCnt-1)) {
+ $iB = ($iBbCnt - 1) - (($iBdCnt - $i1stBdL) % ($iBbCnt - 1));
+ for ($i = 0; $i < $iB; ++$i) {
+ fwrite($FILE, pack("V", -1));
+ }
+ }
+ fwrite($FILE, pack("V", -2));
+ }
+ }
}
diff --git a/Classes/PHPExcel/Shared/OLERead.php b/Classes/PHPExcel/Shared/OLERead.php
index b50fd055..9a8729f1 100644
--- a/Classes/PHPExcel/Shared/OLERead.php
+++ b/Classes/PHPExcel/Shared/OLERead.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Shared
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
@@ -29,289 +29,289 @@ defined('IDENTIFIER_OLE') ||
define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1));
class PHPExcel_Shared_OLERead {
- private $data = '';
+ private $data = '';
- // OLE identifier
- const IDENTIFIER_OLE = IDENTIFIER_OLE;
+ // OLE identifier
+ const IDENTIFIER_OLE = IDENTIFIER_OLE;
- // Size of a sector = 512 bytes
- const BIG_BLOCK_SIZE = 0x200;
+ // Size of a sector = 512 bytes
+ const BIG_BLOCK_SIZE = 0x200;
- // Size of a short sector = 64 bytes
- const SMALL_BLOCK_SIZE = 0x40;
+ // Size of a short sector = 64 bytes
+ const SMALL_BLOCK_SIZE = 0x40;
- // Size of a directory entry always = 128 bytes
- const PROPERTY_STORAGE_BLOCK_SIZE = 0x80;
+ // Size of a directory entry always = 128 bytes
+ const PROPERTY_STORAGE_BLOCK_SIZE = 0x80;
- // Minimum size of a standard stream = 4096 bytes, streams smaller than this are stored as short streams
- const SMALL_BLOCK_THRESHOLD = 0x1000;
+ // Minimum size of a standard stream = 4096 bytes, streams smaller than this are stored as short streams
+ const SMALL_BLOCK_THRESHOLD = 0x1000;
- // header offsets
- const NUM_BIG_BLOCK_DEPOT_BLOCKS_POS = 0x2c;
- const ROOT_START_BLOCK_POS = 0x30;
- const SMALL_BLOCK_DEPOT_BLOCK_POS = 0x3c;
- const EXTENSION_BLOCK_POS = 0x44;
- const NUM_EXTENSION_BLOCK_POS = 0x48;
- const BIG_BLOCK_DEPOT_BLOCKS_POS = 0x4c;
+ // header offsets
+ const NUM_BIG_BLOCK_DEPOT_BLOCKS_POS = 0x2c;
+ const ROOT_START_BLOCK_POS = 0x30;
+ const SMALL_BLOCK_DEPOT_BLOCK_POS = 0x3c;
+ const EXTENSION_BLOCK_POS = 0x44;
+ const NUM_EXTENSION_BLOCK_POS = 0x48;
+ const BIG_BLOCK_DEPOT_BLOCKS_POS = 0x4c;
- // property storage offsets (directory offsets)
- const SIZE_OF_NAME_POS = 0x40;
- const TYPE_POS = 0x42;
- const START_BLOCK_POS = 0x74;
- const SIZE_POS = 0x78;
+ // property storage offsets (directory offsets)
+ const SIZE_OF_NAME_POS = 0x40;
+ const TYPE_POS = 0x42;
+ const START_BLOCK_POS = 0x74;
+ const SIZE_POS = 0x78;
- public $wrkbook = null;
- public $summaryInformation = null;
- public $documentSummaryInformation = null;
+ public $wrkbook = null;
+ public $summaryInformation = null;
+ public $documentSummaryInformation = null;
- /**
- * Read the file
- *
- * @param $sFileName string Filename
- * @throws PHPExcel_Reader_Exception
- */
- public function read($sFileName)
- {
- // Check if file exists and is readable
- if(!is_readable($sFileName)) {
- throw new PHPExcel_Reader_Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable.");
- }
+ /**
+ * Read the file
+ *
+ * @param $sFileName string Filename
+ * @throws PHPExcel_Reader_Exception
+ */
+ public function read($sFileName)
+ {
+ // Check if file exists and is readable
+ if(!is_readable($sFileName)) {
+ throw new PHPExcel_Reader_Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable.");
+ }
- // Get the file identifier
- // Don't bother reading the whole file until we know it's a valid OLE file
- $this->data = file_get_contents($sFileName, FALSE, NULL, 0, 8);
+ // Get the file identifier
+ // Don't bother reading the whole file until we know it's a valid OLE file
+ $this->data = file_get_contents($sFileName, FALSE, NULL, 0, 8);
- // Check OLE identifier
- if ($this->data != self::IDENTIFIER_OLE) {
- throw new PHPExcel_Reader_Exception('The filename ' . $sFileName . ' is not recognised as an OLE file');
- }
+ // Check OLE identifier
+ if ($this->data != self::IDENTIFIER_OLE) {
+ throw new PHPExcel_Reader_Exception('The filename ' . $sFileName . ' is not recognised as an OLE file');
+ }
- // Get the file data
- $this->data = file_get_contents($sFileName);
+ // Get the file data
+ $this->data = file_get_contents($sFileName);
- // Total number of sectors used for the SAT
- $this->numBigBlockDepotBlocks = self::_GetInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS);
+ // Total number of sectors used for the SAT
+ $this->numBigBlockDepotBlocks = self::_GetInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS);
- // SecID of the first sector of the directory stream
- $this->rootStartBlock = self::_GetInt4d($this->data, self::ROOT_START_BLOCK_POS);
+ // SecID of the first sector of the directory stream
+ $this->rootStartBlock = self::_GetInt4d($this->data, self::ROOT_START_BLOCK_POS);
- // SecID of the first sector of the SSAT (or -2 if not extant)
- $this->sbdStartBlock = self::_GetInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS);
+ // SecID of the first sector of the SSAT (or -2 if not extant)
+ $this->sbdStartBlock = self::_GetInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS);
- // SecID of the first sector of the MSAT (or -2 if no additional sectors are used)
- $this->extensionBlock = self::_GetInt4d($this->data, self::EXTENSION_BLOCK_POS);
+ // SecID of the first sector of the MSAT (or -2 if no additional sectors are used)
+ $this->extensionBlock = self::_GetInt4d($this->data, self::EXTENSION_BLOCK_POS);
- // Total number of sectors used by MSAT
- $this->numExtensionBlocks = self::_GetInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS);
+ // Total number of sectors used by MSAT
+ $this->numExtensionBlocks = self::_GetInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS);
- $bigBlockDepotBlocks = array();
- $pos = self::BIG_BLOCK_DEPOT_BLOCKS_POS;
+ $bigBlockDepotBlocks = array();
+ $pos = self::BIG_BLOCK_DEPOT_BLOCKS_POS;
- $bbdBlocks = $this->numBigBlockDepotBlocks;
+ $bbdBlocks = $this->numBigBlockDepotBlocks;
- if ($this->numExtensionBlocks != 0) {
- $bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS)/4;
- }
+ if ($this->numExtensionBlocks != 0) {
+ $bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS)/4;
+ }
- for ($i = 0; $i < $bbdBlocks; ++$i) {
- $bigBlockDepotBlocks[$i] = self::_GetInt4d($this->data, $pos);
- $pos += 4;
- }
+ for ($i = 0; $i < $bbdBlocks; ++$i) {
+ $bigBlockDepotBlocks[$i] = self::_GetInt4d($this->data, $pos);
+ $pos += 4;
+ }
- for ($j = 0; $j < $this->numExtensionBlocks; ++$j) {
- $pos = ($this->extensionBlock + 1) * self::BIG_BLOCK_SIZE;
- $blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1);
+ for ($j = 0; $j < $this->numExtensionBlocks; ++$j) {
+ $pos = ($this->extensionBlock + 1) * self::BIG_BLOCK_SIZE;
+ $blocksToRead = min($this->numBigBlockDepotBlocks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1);
- for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; ++$i) {
- $bigBlockDepotBlocks[$i] = self::_GetInt4d($this->data, $pos);
- $pos += 4;
- }
+ for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; ++$i) {
+ $bigBlockDepotBlocks[$i] = self::_GetInt4d($this->data, $pos);
+ $pos += 4;
+ }
- $bbdBlocks += $blocksToRead;
- if ($bbdBlocks < $this->numBigBlockDepotBlocks) {
- $this->extensionBlock = self::_GetInt4d($this->data, $pos);
- }
- }
+ $bbdBlocks += $blocksToRead;
+ if ($bbdBlocks < $this->numBigBlockDepotBlocks) {
+ $this->extensionBlock = self::_GetInt4d($this->data, $pos);
+ }
+ }
- $pos = 0;
- $this->bigBlockChain = '';
- $bbs = self::BIG_BLOCK_SIZE / 4;
- for ($i = 0; $i < $this->numBigBlockDepotBlocks; ++$i) {
- $pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE;
+ $pos = 0;
+ $this->bigBlockChain = '';
+ $bbs = self::BIG_BLOCK_SIZE / 4;
+ for ($i = 0; $i < $this->numBigBlockDepotBlocks; ++$i) {
+ $pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE;
- $this->bigBlockChain .= substr($this->data, $pos, 4*$bbs);
- $pos += 4*$bbs;
- }
+ $this->bigBlockChain .= substr($this->data, $pos, 4*$bbs);
+ $pos += 4*$bbs;
+ }
- $pos = 0;
- $sbdBlock = $this->sbdStartBlock;
- $this->smallBlockChain = '';
- while ($sbdBlock != -2) {
- $pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE;
+ $pos = 0;
+ $sbdBlock = $this->sbdStartBlock;
+ $this->smallBlockChain = '';
+ while ($sbdBlock != -2) {
+ $pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE;
- $this->smallBlockChain .= substr($this->data, $pos, 4*$bbs);
- $pos += 4*$bbs;
+ $this->smallBlockChain .= substr($this->data, $pos, 4*$bbs);
+ $pos += 4*$bbs;
- $sbdBlock = self::_GetInt4d($this->bigBlockChain, $sbdBlock*4);
- }
+ $sbdBlock = self::_GetInt4d($this->bigBlockChain, $sbdBlock*4);
+ }
- // read the directory stream
- $block = $this->rootStartBlock;
- $this->entry = $this->_readData($block);
+ // read the directory stream
+ $block = $this->rootStartBlock;
+ $this->entry = $this->_readData($block);
- $this->_readPropertySets();
- }
+ $this->_readPropertySets();
+ }
- /**
- * Extract binary stream data
- *
- * @return string
- */
- public function getStream($stream)
- {
- if ($stream === NULL) {
- return null;
- }
+ /**
+ * Extract binary stream data
+ *
+ * @return string
+ */
+ public function getStream($stream)
+ {
+ if ($stream === NULL) {
+ return null;
+ }
- $streamData = '';
+ $streamData = '';
- if ($this->props[$stream]['size'] < self::SMALL_BLOCK_THRESHOLD) {
- $rootdata = $this->_readData($this->props[$this->rootentry]['startBlock']);
+ if ($this->props[$stream]['size'] < self::SMALL_BLOCK_THRESHOLD) {
+ $rootdata = $this->_readData($this->props[$this->rootentry]['startBlock']);
- $block = $this->props[$stream]['startBlock'];
+ $block = $this->props[$stream]['startBlock'];
- while ($block != -2) {
- $pos = $block * self::SMALL_BLOCK_SIZE;
- $streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE);
+ while ($block != -2) {
+ $pos = $block * self::SMALL_BLOCK_SIZE;
+ $streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE);
- $block = self::_GetInt4d($this->smallBlockChain, $block*4);
- }
+ $block = self::_GetInt4d($this->smallBlockChain, $block*4);
+ }
- return $streamData;
- } else {
- $numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE;
- if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) {
- ++$numBlocks;
- }
+ return $streamData;
+ } else {
+ $numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE;
+ if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) {
+ ++$numBlocks;
+ }
- if ($numBlocks == 0) return '';
+ if ($numBlocks == 0) return '';
- $block = $this->props[$stream]['startBlock'];
+ $block = $this->props[$stream]['startBlock'];
- while ($block != -2) {
- $pos = ($block + 1) * self::BIG_BLOCK_SIZE;
- $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
- $block = self::_GetInt4d($this->bigBlockChain, $block*4);
- }
+ while ($block != -2) {
+ $pos = ($block + 1) * self::BIG_BLOCK_SIZE;
+ $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
+ $block = self::_GetInt4d($this->bigBlockChain, $block*4);
+ }
- return $streamData;
- }
- }
+ return $streamData;
+ }
+ }
- /**
- * Read a standard stream (by joining sectors using information from SAT)
- *
- * @param int $bl Sector ID where the stream starts
- * @return string Data for standard stream
- */
- private function _readData($bl)
- {
- $block = $bl;
- $data = '';
+ /**
+ * Read a standard stream (by joining sectors using information from SAT)
+ *
+ * @param int $bl Sector ID where the stream starts
+ * @return string Data for standard stream
+ */
+ private function _readData($bl)
+ {
+ $block = $bl;
+ $data = '';
- while ($block != -2) {
- $pos = ($block + 1) * self::BIG_BLOCK_SIZE;
- $data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
- $block = self::_GetInt4d($this->bigBlockChain, $block*4);
- }
- return $data;
- }
+ while ($block != -2) {
+ $pos = ($block + 1) * self::BIG_BLOCK_SIZE;
+ $data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
+ $block = self::_GetInt4d($this->bigBlockChain, $block*4);
+ }
+ return $data;
+ }
- /**
- * Read entries in the directory stream.
- */
- private function _readPropertySets() {
- $offset = 0;
+ /**
+ * Read entries in the directory stream.
+ */
+ private function _readPropertySets() {
+ $offset = 0;
- // loop through entires, each entry is 128 bytes
- $entryLen = strlen($this->entry);
- while ($offset < $entryLen) {
- // entry data (128 bytes)
- $d = substr($this->entry, $offset, self::PROPERTY_STORAGE_BLOCK_SIZE);
+ // loop through entires, each entry is 128 bytes
+ $entryLen = strlen($this->entry);
+ while ($offset < $entryLen) {
+ // entry data (128 bytes)
+ $d = substr($this->entry, $offset, self::PROPERTY_STORAGE_BLOCK_SIZE);
- // size in bytes of name
- $nameSize = ord($d[self::SIZE_OF_NAME_POS]) | (ord($d[self::SIZE_OF_NAME_POS+1]) << 8);
+ // size in bytes of name
+ $nameSize = ord($d[self::SIZE_OF_NAME_POS]) | (ord($d[self::SIZE_OF_NAME_POS+1]) << 8);
- // type of entry
- $type = ord($d[self::TYPE_POS]);
+ // type of entry
+ $type = ord($d[self::TYPE_POS]);
- // sectorID of first sector or short sector, if this entry refers to a stream (the case with workbook)
- // sectorID of first sector of the short-stream container stream, if this entry is root entry
- $startBlock = self::_GetInt4d($d, self::START_BLOCK_POS);
+ // sectorID of first sector or short sector, if this entry refers to a stream (the case with workbook)
+ // sectorID of first sector of the short-stream container stream, if this entry is root entry
+ $startBlock = self::_GetInt4d($d, self::START_BLOCK_POS);
- $size = self::_GetInt4d($d, self::SIZE_POS);
+ $size = self::_GetInt4d($d, self::SIZE_POS);
- $name = str_replace("\x00", "", substr($d,0,$nameSize));
+ $name = str_replace("\x00", "", substr($d,0,$nameSize));
- $this->props[] = array (
- 'name' => $name,
- 'type' => $type,
- 'startBlock' => $startBlock,
- 'size' => $size);
+ $this->props[] = array (
+ 'name' => $name,
+ 'type' => $type,
+ 'startBlock' => $startBlock,
+ 'size' => $size);
- // tmp helper to simplify checks
- $upName = strtoupper($name);
+ // tmp helper to simplify checks
+ $upName = strtoupper($name);
- // Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook)
- if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) {
- $this->wrkbook = count($this->props) - 1;
- }
- else if ( $upName === 'ROOT ENTRY' || $upName === 'R') {
- // Root entry
- $this->rootentry = count($this->props) - 1;
- }
+ // Workbook directory entry (BIFF5 uses Book, BIFF8 uses Workbook)
+ if (($upName === 'WORKBOOK') || ($upName === 'BOOK')) {
+ $this->wrkbook = count($this->props) - 1;
+ }
+ else if ( $upName === 'ROOT ENTRY' || $upName === 'R') {
+ // Root entry
+ $this->rootentry = count($this->props) - 1;
+ }
- // Summary information
- if ($name == chr(5) . 'SummaryInformation') {
-// echo 'Summary Information
';
- $this->summaryInformation = count($this->props) - 1;
- }
+ // Summary information
+ if ($name == chr(5) . 'SummaryInformation') {
+// echo 'Summary Information
';
+ $this->summaryInformation = count($this->props) - 1;
+ }
- // Additional Document Summary information
- if ($name == chr(5) . 'DocumentSummaryInformation') {
-// echo 'Document Summary Information
';
- $this->documentSummaryInformation = count($this->props) - 1;
- }
+ // Additional Document Summary information
+ if ($name == chr(5) . 'DocumentSummaryInformation') {
+// echo 'Document Summary Information
';
+ $this->documentSummaryInformation = count($this->props) - 1;
+ }
- $offset += self::PROPERTY_STORAGE_BLOCK_SIZE;
- }
+ $offset += self::PROPERTY_STORAGE_BLOCK_SIZE;
+ }
- }
+ }
- /**
- * Read 4 bytes of data at specified position
- *
- * @param string $data
- * @param int $pos
- * @return int
- */
- private static function _GetInt4d($data, $pos)
- {
- // FIX: represent numbers correctly on 64-bit system
- // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334
- // Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems
- $_or_24 = ord($data[$pos + 3]);
- if ($_or_24 >= 128) {
- // negative number
- $_ord_24 = -abs((256 - $_or_24) << 24);
- } else {
- $_ord_24 = ($_or_24 & 127) << 24;
- }
- return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24;
- }
+ /**
+ * Read 4 bytes of data at specified position
+ *
+ * @param string $data
+ * @param int $pos
+ * @return int
+ */
+ private static function _GetInt4d($data, $pos)
+ {
+ // FIX: represent numbers correctly on 64-bit system
+ // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334
+ // Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems
+ $_or_24 = ord($data[$pos + 3]);
+ if ($_or_24 >= 128) {
+ // negative number
+ $_ord_24 = -abs((256 - $_or_24) << 24);
+ } else {
+ $_ord_24 = ($_or_24 & 127) << 24;
+ }
+ return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $_ord_24;
+ }
}
diff --git a/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php b/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php
index 5b81e679..cafc4fa0 100644
--- a/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php
+++ b/Classes/PHPExcel/Shared/PCLZip/pclzip.lib.php
@@ -327,7 +327,7 @@
}
else if ($v_size > 2) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
- "Invalid number / type of arguments");
+ "Invalid number / type of arguments");
return 0;
}
}
@@ -388,7 +388,7 @@
,PCLZIP_ATT_FILE_MTIME => 'optional'
,PCLZIP_ATT_FILE_CONTENT => 'optional'
,PCLZIP_ATT_FILE_COMMENT => 'optional'
- );
+ );
foreach ($v_att_list as $v_entry) {
$v_result = $this->privFileDescrParseAtt($v_entry,
$v_filedescr_list[],
@@ -492,7 +492,7 @@
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
//, PCLZIP_OPT_CRYPT => 'optional'
- ));
+ ));
if ($v_result != 1) {
return 0;
}
@@ -571,7 +571,7 @@
,PCLZIP_ATT_FILE_MTIME => 'optional'
,PCLZIP_ATT_FILE_CONTENT => 'optional'
,PCLZIP_ATT_FILE_COMMENT => 'optional'
- );
+ );
foreach ($v_att_list as $v_entry) {
$v_result = $this->privFileDescrParseAtt($v_entry,
$v_filedescr_list[],
@@ -751,7 +751,7 @@
PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
- ));
+ ));
if ($v_result != 1) {
return 0;
}
@@ -805,7 +805,7 @@
// ----- Call the extracting fct
$p_list = array();
$v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
- $v_remove_all_path, $v_options);
+ $v_remove_all_path, $v_options);
if ($v_result < 1) {
unset($p_list);
return(0);
@@ -907,7 +907,7 @@
PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
- ));
+ ));
if ($v_result != 1) {
return 0;
}
@@ -1374,7 +1374,7 @@
{
$v_result = true;
- // ----- Reset the file system cache
+ // ----- Reset the file system cache
clearstatcache();
// ----- Reset the error handler
@@ -1596,9 +1596,9 @@
if (($i+1) >= $p_size) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
- "Missing parameter value for option '"
- .PclZipUtilOptionText($p_options_list[$i])
- ."'");
+ "Missing parameter value for option '"
+ .PclZipUtilOptionText($p_options_list[$i])
+ ."'");
// ----- Return
return PclZip::errorCode();
@@ -1611,9 +1611,9 @@
else {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
- "Wrong parameter value for option '"
- .PclZipUtilOptionText($p_options_list[$i])
- ."'");
+ "Wrong parameter value for option '"
+ .PclZipUtilOptionText($p_options_list[$i])
+ ."'");
// ----- Return
return PclZip::errorCode();
@@ -1779,8 +1779,8 @@
default :
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
- "Unknown parameter '"
- .$p_options_list[$i]."'");
+ "Unknown parameter '"
+ .$p_options_list[$i]."'");
// ----- Return
return PclZip::errorCode();
@@ -1954,7 +1954,7 @@
default :
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
- "Unknown parameter '".$v_key."'");
+ "Unknown parameter '".$v_key."'");
// ----- Return
return PclZip::errorCode();
@@ -3033,12 +3033,12 @@
// ----- Packed data
$v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
- $p_header['version_extracted'], $p_header['flag'],
+ $p_header['version_extracted'], $p_header['flag'],
$p_header['compression'], $v_mtime, $v_mdate,
$p_header['crc'], $p_header['compressed_size'],
- $p_header['size'],
+ $p_header['size'],
strlen($p_header['stored_filename']),
- $p_header['extra_len']);
+ $p_header['extra_len']);
// ----- Write the first 148 bytes of the header in the archive
fputs($this->zip_fd, $v_binary_data, 30);
@@ -3080,14 +3080,14 @@
// ----- Packed data
$v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
- $p_header['version'], $p_header['version_extracted'],
+ $p_header['version'], $p_header['version_extracted'],
$p_header['flag'], $p_header['compression'],
- $v_mtime, $v_mdate, $p_header['crc'],
+ $v_mtime, $v_mdate, $p_header['crc'],
$p_header['compressed_size'], $p_header['size'],
strlen($p_header['stored_filename']),
- $p_header['extra_len'], $p_header['comment_len'],
+ $p_header['extra_len'], $p_header['comment_len'],
$p_header['disk'], $p_header['internal'],
- $p_header['external'], $p_header['offset']);
+ $p_header['external'], $p_header['offset']);
// ----- Write the 42 bytes of the header in the zip file
fputs($this->zip_fd, $v_binary_data, 46);
@@ -3123,8 +3123,8 @@
// ----- Packed data
$v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,
- $p_nb_entries, $p_size,
- $p_offset, strlen($p_comment));
+ $p_nb_entries, $p_size,
+ $p_offset, strlen($p_comment));
// ----- Write the 22 bytes of the header in the zip file
fputs($this->zip_fd, $v_binary_data, 22);
@@ -3281,9 +3281,9 @@
// ----- Check the path
if ( ($p_path == "")
- || ( (substr($p_path, 0, 1) != "/")
- && (substr($p_path, 0, 3) != "../")
- && (substr($p_path,1,2)!=":/")))
+ || ( (substr($p_path, 0, 1) != "/")
+ && (substr($p_path, 0, 3) != "../")
+ && (substr($p_path,1,2)!=":/")))
$p_path = "./".$p_path;
// ----- Reduce the path last (and duplicated) '/'
@@ -3433,50 +3433,50 @@
$v_extract = true;
}
- // ----- Check compression method
- if ( ($v_extract)
- && ( ($v_header['compression'] != 8)
- && ($v_header['compression'] != 0))) {
+ // ----- Check compression method
+ if ( ($v_extract)
+ && ( ($v_header['compression'] != 8)
+ && ($v_header['compression'] != 0))) {
$v_header['status'] = 'unsupported_compression';
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
- && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+ && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
$this->privSwapBackMagicQuotes();
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
- "Filename '".$v_header['stored_filename']."' is "
- ."compressed by an unsupported compression "
- ."method (".$v_header['compression'].") ");
+ "Filename '".$v_header['stored_filename']."' is "
+ ."compressed by an unsupported compression "
+ ."method (".$v_header['compression'].") ");
return PclZip::errorCode();
- }
- }
-
- // ----- Check encrypted files
- if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
+ }
+ }
+
+ // ----- Check encrypted files
+ if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
$v_header['status'] = 'unsupported_encryption';
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
- && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+ && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
$this->privSwapBackMagicQuotes();
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION,
- "Unsupported encryption for "
- ." filename '".$v_header['stored_filename']
- ."'");
+ "Unsupported encryption for "
+ ." filename '".$v_header['stored_filename']
+ ."'");
return PclZip::errorCode();
- }
+ }
}
// ----- Look for real extraction
if (($v_extract) && ($v_header['status'] != 'ok')) {
$v_result = $this->privConvertHeader2FileInfo($v_header,
- $p_file_list[$v_nb_extracted++]);
+ $p_file_list[$v_nb_extracted++]);
if ($v_result != 1) {
$this->privCloseFd();
$this->privSwapBackMagicQuotes();
@@ -3537,12 +3537,12 @@
// ----- Look for user callback abort
if ($v_result1 == 2) {
- break;
+ break;
}
}
// ----- Look for extraction in standard output
elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
- && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
+ && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
// ----- Extracting the file in standard output
$v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
if ($v_result1 < 1) {
@@ -3560,16 +3560,16 @@
// ----- Look for user callback abort
if ($v_result1 == 2) {
- break;
+ break;
}
}
// ----- Look for normal extraction
else {
// ----- Extracting the file
$v_result1 = $this->privExtractFile($v_header,
- $p_path, $p_remove_path,
- $p_remove_all_path,
- $p_options);
+ $p_path, $p_remove_path,
+ $p_remove_all_path,
+ $p_options);
if ($v_result1 < 1) {
$this->privCloseFd();
$this->privSwapBackMagicQuotes();
@@ -3588,7 +3588,7 @@
// ----- Look for user callback abort
if ($v_result1 == 2) {
- break;
+ break;
}
}
}
@@ -3679,8 +3679,8 @@
if ($v_inclusion == 0) {
PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,
- "Filename '".$p_entry['filename']."' is "
- ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
+ "Filename '".$p_entry['filename']."' is "
+ ."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
return PclZip::errorCode();
}
@@ -3708,7 +3708,7 @@
if ($v_result == 2) {
// ----- This status is internal and will be changed in 'skipped'
$p_entry['status'] = "aborted";
- $v_result = PCLZIP_ERR_USER_ABORTED;
+ $v_result = PCLZIP_ERR_USER_ABORTED;
}
// ----- Update the informations
@@ -3735,14 +3735,14 @@
// For historical reason first PclZip implementation does not stop
// when this kind of error occurs.
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
- && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+ && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
- "Filename '".$p_entry['filename']."' is "
- ."already used by an existing directory");
+ "Filename '".$p_entry['filename']."' is "
+ ."already used by an existing directory");
return PclZip::errorCode();
- }
+ }
}
// ----- Look if file is write protected
else if (!is_writeable($p_entry['filename']))
@@ -3755,14 +3755,14 @@
// For historical reason first PclZip implementation does not stop
// when this kind of error occurs.
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
- && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+ && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
- "Filename '".$p_entry['filename']."' exists "
- ."and is write protected");
+ "Filename '".$p_entry['filename']."' exists "
+ ."and is write protected");
return PclZip::errorCode();
- }
+ }
}
// ----- Look if the extracted file is older
@@ -3770,24 +3770,24 @@
{
// ----- Change the file status
if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
- && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
- }
- else {
+ && ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
+ }
+ else {
$p_entry['status'] = "newer_exist";
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
// For historical reason first PclZip implementation does not stop
// when this kind of error occurs.
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
- && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
+ && ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
- "Newer version of '".$p_entry['filename']."' exists "
- ."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
+ "Newer version of '".$p_entry['filename']."' exists "
+ ."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
return PclZip::errorCode();
- }
- }
+ }
+ }
}
else {
}
@@ -3823,7 +3823,7 @@
// ----- Look for not compressed file
if ($p_entry['compression'] == 0) {
- // ----- Opening destination file
+ // ----- Opening destination file
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
{
@@ -3928,11 +3928,11 @@
}
}
- // ----- Change abort status
- if ($p_entry['status'] == "aborted") {
+ // ----- Change abort status
+ if ($p_entry['status'] == "aborted") {
$p_entry['status'] = "skipped";
- }
-
+ }
+
// ----- Look for post-extract callback
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
@@ -3948,7 +3948,7 @@
// ----- Look for abort result
if ($v_result == 2) {
- $v_result = PCLZIP_ERR_USER_ABORTED;
+ $v_result = PCLZIP_ERR_USER_ABORTED;
}
}
@@ -4076,7 +4076,7 @@
if ($v_result == 2) {
// ----- This status is internal and will be changed in 'skipped'
$p_entry['status'] = "aborted";
- $v_result = PCLZIP_ERR_USER_ABORTED;
+ $v_result = PCLZIP_ERR_USER_ABORTED;
}
// ----- Update the informations
@@ -4117,10 +4117,10 @@
}
}
- // ----- Change abort status
- if ($p_entry['status'] == "aborted") {
+ // ----- Change abort status
+ if ($p_entry['status'] == "aborted") {
$p_entry['status'] = "skipped";
- }
+ }
// ----- Look for post-extract callback
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
@@ -4137,7 +4137,7 @@
// ----- Look for abort result
if ($v_result == 2) {
- $v_result = PCLZIP_ERR_USER_ABORTED;
+ $v_result = PCLZIP_ERR_USER_ABORTED;
}
}
@@ -4191,7 +4191,7 @@
if ($v_result == 2) {
// ----- This status is internal and will be changed in 'skipped'
$p_entry['status'] = "aborted";
- $v_result = PCLZIP_ERR_USER_ABORTED;
+ $v_result = PCLZIP_ERR_USER_ABORTED;
}
// ----- Update the informations
@@ -4231,11 +4231,11 @@
}
- // ----- Change abort status
- if ($p_entry['status'] == "aborted") {
+ // ----- Change abort status
+ if ($p_entry['status'] == "aborted") {
$p_entry['status'] = "skipped";
- }
-
+ }
+
// ----- Look for post-extract callback
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
@@ -4259,7 +4259,7 @@
// ----- Look for abort result
if ($v_result == 2) {
- $v_result = PCLZIP_ERR_USER_ABORTED;
+ $v_result = PCLZIP_ERR_USER_ABORTED;
}
}
@@ -4489,27 +4489,27 @@
{
$v_result=1;
- // ----- Check the static values
- // TBC
- if ($p_local_header['filename'] != $p_central_header['filename']) {
- }
- if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
- }
- if ($p_local_header['flag'] != $p_central_header['flag']) {
- }
- if ($p_local_header['compression'] != $p_central_header['compression']) {
- }
- if ($p_local_header['mtime'] != $p_central_header['mtime']) {
- }
- if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
- }
+ // ----- Check the static values
+ // TBC
+ if ($p_local_header['filename'] != $p_central_header['filename']) {
+ }
+ if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
+ }
+ if ($p_local_header['flag'] != $p_central_header['flag']) {
+ }
+ if ($p_local_header['compression'] != $p_central_header['compression']) {
+ }
+ if ($p_local_header['mtime'] != $p_central_header['mtime']) {
+ }
+ if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
+ }
- // ----- Look for flag bit 3
- if (($p_local_header['flag'] & 8) == 8) {
+ // ----- Look for flag bit 3
+ if (($p_local_header['flag'] & 8) == 8) {
$p_local_header['size'] = $p_central_header['size'];
$p_local_header['compressed_size'] = $p_central_header['compressed_size'];
$p_local_header['crc'] = $p_central_header['crc'];
- }
+ }
// ----- Return
return $v_result;
@@ -4635,19 +4635,19 @@
// ----- Check the global size
if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
- // ----- Removed in release 2.2 see readme file
- // The check of the file size is a little too strict.
- // Some bugs where found when a zip is encrypted/decrypted with 'crypt'.
- // While decrypted, zip has training 0 bytes
- if (0) {
+ // ----- Removed in release 2.2 see readme file
+ // The check of the file size is a little too strict.
+ // Some bugs where found when a zip is encrypted/decrypted with 'crypt'.
+ // While decrypted, zip has training 0 bytes
+ if (0) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT,
- 'The central dir is not at the end of the archive.'
- .' Some trailing bytes exists after the archive.');
+ 'The central dir is not at the end of the archive.'
+ .' Some trailing bytes exists after the archive.');
// ----- Return
return PclZip::errorCode();
- }
+ }
}
// ----- Get comment
@@ -4809,7 +4809,7 @@
}
}
else {
- $v_found = true;
+ $v_found = true;
}
// ----- Look for deletion
@@ -4872,7 +4872,7 @@
// ----- Check that local file header is same as central file header
if ($this->privCheckFileHeaders($v_local_header,
- $v_header_list[$i]) != 1) {
+ $v_header_list[$i]) != 1) {
// TBC
}
unset($v_local_header);
@@ -5330,22 +5330,22 @@
// ----- Look if function exists
if ( (!function_exists("get_magic_quotes_runtime"))
- || (!function_exists("set_magic_quotes_runtime"))) {
+ || (!function_exists("set_magic_quotes_runtime"))) {
return $v_result;
- }
+ }
// ----- Look if already done
if ($this->magic_quotes_status != -1) {
return $v_result;
- }
+ }
- // ----- Get and memorize the magic_quote value
- $this->magic_quotes_status = @get_magic_quotes_runtime();
+ // ----- Get and memorize the magic_quote value
+ $this->magic_quotes_status = @get_magic_quotes_runtime();
- // ----- Disable magic_quotes
- if ($this->magic_quotes_status == 1) {
- @set_magic_quotes_runtime(0);
- }
+ // ----- Disable magic_quotes
+ if ($this->magic_quotes_status == 1) {
+ @set_magic_quotes_runtime(0);
+ }
// ----- Return
return $v_result;
@@ -5364,19 +5364,19 @@
// ----- Look if function exists
if ( (!function_exists("get_magic_quotes_runtime"))
- || (!function_exists("set_magic_quotes_runtime"))) {
+ || (!function_exists("set_magic_quotes_runtime"))) {
return $v_result;
- }
+ }
// ----- Look if something to do
if ($this->magic_quotes_status != -1) {
return $v_result;
- }
+ }
- // ----- Swap back magic_quotes
- if ($this->magic_quotes_status == 1) {
- @set_magic_quotes_runtime($this->magic_quotes_status);
- }
+ // ----- Swap back magic_quotes
+ if ($this->magic_quotes_status == 1) {
+ @set_magic_quotes_runtime($this->magic_quotes_status);
+ }
// ----- Return
return $v_result;
@@ -5411,37 +5411,37 @@
// Should be the first $i=0, but no check is done
}
else if ($v_list[$i] == "..") {
- $v_skip++;
+ $v_skip++;
}
else if ($v_list[$i] == "") {
- // ----- First '/' i.e. root slash
- if ($i == 0) {
+ // ----- First '/' i.e. root slash
+ if ($i == 0) {
$v_result = "/".$v_result;
- if ($v_skip > 0) {
- // ----- It is an invalid path, so the path is not modified
- // TBC
- $v_result = $p_dir;
+ if ($v_skip > 0) {
+ // ----- It is an invalid path, so the path is not modified
+ // TBC
+ $v_result = $p_dir;
$v_skip = 0;
- }
- }
- // ----- Last '/' i.e. indicates a directory
- else if ($i == (sizeof($v_list)-1)) {
+ }
+ }
+ // ----- Last '/' i.e. indicates a directory
+ else if ($i == (sizeof($v_list)-1)) {
$v_result = $v_list[$i];
- }
- // ----- Double '/' inside the path
- else {
+ }
+ // ----- Double '/' inside the path
+ else {
// ----- Ignore only the double '//' in path,
// but not the first and last '/'
- }
+ }
}
else {
- // ----- Look for item to skip
- if ($v_skip > 0) {
- $v_skip--;
- }
- else {
+ // ----- Look for item to skip
+ if ($v_skip > 0) {
+ $v_skip--;
+ }
+ else {
$v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
- }
+ }
}
}
@@ -5648,13 +5648,13 @@
$v_list = get_defined_constants();
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
- $v_prefix = substr($v_key, 0, 10);
- if (( ($v_prefix == 'PCLZIP_OPT')
+ $v_prefix = substr($v_key, 0, 10);
+ if (( ($v_prefix == 'PCLZIP_OPT')
|| ($v_prefix == 'PCLZIP_CB_')
|| ($v_prefix == 'PCLZIP_ATT'))
- && ($v_list[$v_key] == $p_option)) {
+ && ($v_list[$v_key] == $p_option)) {
return $v_key;
- }
+ }
}
$v_result = 'Unknown';
diff --git a/Classes/PHPExcel/Shared/PasswordHasher.php b/Classes/PHPExcel/Shared/PasswordHasher.php
index db0707f2..92c8b3f9 100644
--- a/Classes/PHPExcel/Shared/PasswordHasher.php
+++ b/Classes/PHPExcel/Shared/PasswordHasher.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Shared
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
@@ -35,32 +35,32 @@
*/
class PHPExcel_Shared_PasswordHasher
{
- /**
- * Create a password hash from a given string.
- *
- * This method is based on the algorithm provided by
- * Daniel Rentz of OpenOffice and the PEAR package
- * Spreadsheet_Excel_Writer by Xavier Noguer
- * $objDrawing->setResizeProportional(true);
- * $objDrawing->setWidthAndHeight(160,120);
- *
- *
+ * Example:
+ *
+ * $objDrawing->setResizeProportional(true);
+ * $objDrawing->setWidthAndHeight(160,120);
+ *
+ *
* @author Vincent@luo MSN:kele_100@hotmail.com
* @param int $width
* @param int $height
* @return PHPExcel_Worksheet_BaseDrawing
*/
- public function setWidthAndHeight($width = 0, $height = 0) {
- $xratio = $width / ($this->_width != 0 ? $this->_width : 1);
- $yratio = $height / ($this->_height != 0 ? $this->_height : 1);
- if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
- if (($xratio * $this->_height) < $height) {
- $this->_height = ceil($xratio * $this->_height);
- $this->_width = $width;
- } else {
- $this->_width = ceil($yratio * $this->_width);
- $this->_height = $height;
- }
- } else {
+ public function setWidthAndHeight($width = 0, $height = 0) {
+ $xratio = $width / ($this->_width != 0 ? $this->_width : 1);
+ $yratio = $height / ($this->_height != 0 ? $this->_height : 1);
+ if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
+ if (($xratio * $this->_height) < $height) {
+ $this->_height = ceil($xratio * $this->_height);
+ $this->_width = $width;
+ } else {
+ $this->_width = ceil($yratio * $this->_width);
+ $this->_height = $height;
+ }
+ } else {
$this->_width = $width;
$this->_height = $height;
}
- return $this;
- }
+ return $this;
+ }
/**
* Get ResizeProportional
@@ -397,7 +397,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @return boolean
*/
public function getResizeProportional() {
- return $this->_resizeProportional;
+ return $this->_resizeProportional;
}
/**
@@ -407,8 +407,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setResizeProportional($pValue = true) {
- $this->_resizeProportional = $pValue;
- return $this;
+ $this->_resizeProportional = $pValue;
+ return $this;
}
/**
@@ -417,7 +417,7 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @return int
*/
public function getRotation() {
- return $this->_rotation;
+ return $this->_rotation;
}
/**
@@ -427,8 +427,8 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setRotation($pValue = 0) {
- $this->_rotation = $pValue;
- return $this;
+ $this->_rotation = $pValue;
+ return $this;
}
/**
@@ -437,53 +437,53 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function getShadow() {
- return $this->_shadow;
+ return $this->_shadow;
}
/**
* Set Shadow
*
- * @param PHPExcel_Worksheet_Drawing_Shadow $pValue
- * @throws PHPExcel_Exception
+ * @param PHPExcel_Worksheet_Drawing_Shadow $pValue
+ * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_BaseDrawing
*/
public function setShadow(PHPExcel_Worksheet_Drawing_Shadow $pValue = null) {
- $this->_shadow = $pValue;
- return $this;
+ $this->_shadow = $pValue;
+ return $this;
}
- /**
- * Get hash code
- *
- * @return string Hash code
- */
- public function getHashCode() {
- return md5(
- $this->_name
- . $this->_description
- . $this->_worksheet->getHashCode()
- . $this->_coordinates
- . $this->_offsetX
- . $this->_offsetY
- . $this->_width
- . $this->_height
- . $this->_rotation
- . $this->_shadow->getHashCode()
- . __CLASS__
- );
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode() {
+ return md5(
+ $this->_name
+ . $this->_description
+ . $this->_worksheet->getHashCode()
+ . $this->_coordinates
+ . $this->_offsetX
+ . $this->_offsetY
+ . $this->_width
+ . $this->_height
+ . $this->_rotation
+ . $this->_shadow->getHashCode()
+ . __CLASS__
+ );
}
- /**
- * Implement PHP __clone to create a deep clone, not just a shallow copy.
- */
- public function __clone() {
- $vars = get_object_vars($this);
- foreach ($vars as $key => $value) {
- if (is_object($value)) {
- $this->$key = clone $value;
- } else {
- $this->$key = $value;
- }
- }
- }
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone() {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
}
diff --git a/Classes/PHPExcel/Worksheet/ColumnDimension.php b/Classes/PHPExcel/Worksheet/ColumnDimension.php
index 956ffdce..05be76fa 100644
--- a/Classes/PHPExcel/Worksheet/ColumnDimension.php
+++ b/Classes/PHPExcel/Worksheet/ColumnDimension.php
@@ -22,7 +22,7 @@
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
class PHPExcel_Worksheet_ColumnDimension
diff --git a/Classes/PHPExcel/Worksheet/Drawing.php b/Classes/PHPExcel/Worksheet/Drawing.php
index d58fcebd..7f9dfd55 100644
--- a/Classes/PHPExcel/Worksheet/Drawing.php
+++ b/Classes/PHPExcel/Worksheet/Drawing.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Worksheet_Drawing
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
@@ -35,23 +35,23 @@
*/
class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
{
- /**
- * Path
- *
- * @var string
- */
- private $_path;
+ /**
+ * Path
+ *
+ * @var string
+ */
+ private $_path;
/**
* Create a new PHPExcel_Worksheet_Drawing
*/
public function __construct()
{
- // Initialise values
- $this->_path = '';
+ // Initialise values
+ $this->_path = '';
- // Initialize parent
- parent::__construct();
+ // Initialize parent
+ parent::__construct();
}
/**
@@ -60,7 +60,7 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* @return string
*/
public function getFilename() {
- return basename($this->_path);
+ return basename($this->_path);
}
/**
@@ -69,9 +69,9 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* @return string
*/
public function getIndexedFilename() {
- $fileName = $this->getFilename();
- $fileName = str_replace(' ', '_', $fileName);
- return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension();
+ $fileName = $this->getFilename();
+ $fileName = str_replace(' ', '_', $fileName);
+ return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension();
}
/**
@@ -80,8 +80,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* @return string
*/
public function getExtension() {
- $exploded = explode(".", basename($this->_path));
- return $exploded[count($exploded) - 1];
+ $exploded = explode(".", basename($this->_path));
+ return $exploded[count($exploded) - 1];
}
/**
@@ -90,59 +90,59 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* @return string
*/
public function getPath() {
- return $this->_path;
+ return $this->_path;
}
/**
* Set Path
*
- * @param string $pValue File path
- * @param boolean $pVerifyFile Verify file
- * @throws PHPExcel_Exception
+ * @param string $pValue File path
+ * @param boolean $pVerifyFile Verify file
+ * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Drawing
*/
public function setPath($pValue = '', $pVerifyFile = true) {
- if ($pVerifyFile) {
- if (file_exists($pValue)) {
- $this->_path = $pValue;
+ if ($pVerifyFile) {
+ if (file_exists($pValue)) {
+ $this->_path = $pValue;
- if ($this->_width == 0 && $this->_height == 0) {
- // Get width/height
- list($this->_width, $this->_height) = getimagesize($pValue);
- }
- } else {
- throw new PHPExcel_Exception("File $pValue not found!");
- }
- } else {
- $this->_path = $pValue;
- }
- return $this;
+ if ($this->_width == 0 && $this->_height == 0) {
+ // Get width/height
+ list($this->_width, $this->_height) = getimagesize($pValue);
+ }
+ } else {
+ throw new PHPExcel_Exception("File $pValue not found!");
+ }
+ } else {
+ $this->_path = $pValue;
+ }
+ return $this;
}
- /**
- * Get hash code
- *
- * @return string Hash code
- */
- public function getHashCode() {
- return md5(
- $this->_path
- . parent::getHashCode()
- . __CLASS__
- );
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode() {
+ return md5(
+ $this->_path
+ . parent::getHashCode()
+ . __CLASS__
+ );
}
- /**
- * Implement PHP __clone to create a deep clone, not just a shallow copy.
- */
- public function __clone() {
- $vars = get_object_vars($this);
- foreach ($vars as $key => $value) {
- if (is_object($value)) {
- $this->$key = clone $value;
- } else {
- $this->$key = $value;
- }
- }
- }
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone() {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
}
diff --git a/Classes/PHPExcel/Worksheet/Drawing/Shadow.php b/Classes/PHPExcel/Worksheet/Drawing/Shadow.php
index cc6289a0..8776745f 100644
--- a/Classes/PHPExcel/Worksheet/Drawing/Shadow.php
+++ b/Classes/PHPExcel/Worksheet/Drawing/Shadow.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Worksheet_Drawing
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
@@ -35,82 +35,82 @@
*/
class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
{
- /* Shadow alignment */
- const SHADOW_BOTTOM = 'b';
- const SHADOW_BOTTOM_LEFT = 'bl';
- const SHADOW_BOTTOM_RIGHT = 'br';
- const SHADOW_CENTER = 'ctr';
- const SHADOW_LEFT = 'l';
- const SHADOW_TOP = 't';
- const SHADOW_TOP_LEFT = 'tl';
- const SHADOW_TOP_RIGHT = 'tr';
+ /* Shadow alignment */
+ const SHADOW_BOTTOM = 'b';
+ const SHADOW_BOTTOM_LEFT = 'bl';
+ const SHADOW_BOTTOM_RIGHT = 'br';
+ const SHADOW_CENTER = 'ctr';
+ const SHADOW_LEFT = 'l';
+ const SHADOW_TOP = 't';
+ const SHADOW_TOP_LEFT = 'tl';
+ const SHADOW_TOP_RIGHT = 'tr';
- /**
- * Visible
- *
- * @var boolean
- */
- private $_visible;
+ /**
+ * Visible
+ *
+ * @var boolean
+ */
+ private $_visible;
- /**
- * Blur radius
- *
- * Defaults to 6
- *
- * @var int
- */
- private $_blurRadius;
+ /**
+ * Blur radius
+ *
+ * Defaults to 6
+ *
+ * @var int
+ */
+ private $_blurRadius;
- /**
- * Shadow distance
- *
- * Defaults to 2
- *
- * @var int
- */
- private $_distance;
+ /**
+ * Shadow distance
+ *
+ * Defaults to 2
+ *
+ * @var int
+ */
+ private $_distance;
- /**
- * Shadow direction (in degrees)
- *
- * @var int
- */
- private $_direction;
+ /**
+ * Shadow direction (in degrees)
+ *
+ * @var int
+ */
+ private $_direction;
- /**
- * Shadow alignment
- *
- * @var int
- */
- private $_alignment;
+ /**
+ * Shadow alignment
+ *
+ * @var int
+ */
+ private $_alignment;
- /**
- * Color
- *
- * @var PHPExcel_Style_Color
- */
- private $_color;
+ /**
+ * Color
+ *
+ * @var PHPExcel_Style_Color
+ */
+ private $_color;
- /**
- * Alpha
- *
- * @var int
- */
- private $_alpha;
+ /**
+ * Alpha
+ *
+ * @var int
+ */
+ private $_alpha;
/**
* Create a new PHPExcel_Worksheet_Drawing_Shadow
*/
public function __construct()
{
- // Initialise values
- $this->_visible = false;
- $this->_blurRadius = 6;
- $this->_distance = 2;
- $this->_direction = 0;
- $this->_alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT;
- $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
- $this->_alpha = 50;
+ // Initialise values
+ $this->_visible = false;
+ $this->_blurRadius = 6;
+ $this->_distance = 2;
+ $this->_direction = 0;
+ $this->_alignment = PHPExcel_Worksheet_Drawing_Shadow::SHADOW_BOTTOM_RIGHT;
+ $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
+ $this->_alpha = 50;
}
/**
@@ -119,7 +119,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @return boolean
*/
public function getVisible() {
- return $this->_visible;
+ return $this->_visible;
}
/**
@@ -129,8 +129,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setVisible($pValue = false) {
- $this->_visible = $pValue;
- return $this;
+ $this->_visible = $pValue;
+ return $this;
}
/**
@@ -139,7 +139,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @return int
*/
public function getBlurRadius() {
- return $this->_blurRadius;
+ return $this->_blurRadius;
}
/**
@@ -149,8 +149,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setBlurRadius($pValue = 6) {
- $this->_blurRadius = $pValue;
- return $this;
+ $this->_blurRadius = $pValue;
+ return $this;
}
/**
@@ -159,7 +159,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @return int
*/
public function getDistance() {
- return $this->_distance;
+ return $this->_distance;
}
/**
@@ -169,8 +169,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setDistance($pValue = 2) {
- $this->_distance = $pValue;
- return $this;
+ $this->_distance = $pValue;
+ return $this;
}
/**
@@ -179,7 +179,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @return int
*/
public function getDirection() {
- return $this->_direction;
+ return $this->_direction;
}
/**
@@ -189,8 +189,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setDirection($pValue = 0) {
- $this->_direction = $pValue;
- return $this;
+ $this->_direction = $pValue;
+ return $this;
}
/**
@@ -199,7 +199,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @return int
*/
public function getAlignment() {
- return $this->_alignment;
+ return $this->_alignment;
}
/**
@@ -209,8 +209,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setAlignment($pValue = 0) {
- $this->_alignment = $pValue;
- return $this;
+ $this->_alignment = $pValue;
+ return $this;
}
/**
@@ -219,19 +219,19 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @return PHPExcel_Style_Color
*/
public function getColor() {
- return $this->_color;
+ return $this->_color;
}
/**
* Set Color
*
- * @param PHPExcel_Style_Color $pValue
- * @throws PHPExcel_Exception
+ * @param PHPExcel_Style_Color $pValue
+ * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setColor(PHPExcel_Style_Color $pValue = null) {
- $this->_color = $pValue;
- return $this;
+ $this->_color = $pValue;
+ return $this;
}
/**
@@ -240,7 +240,7 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @return int
*/
public function getAlpha() {
- return $this->_alpha;
+ return $this->_alpha;
}
/**
@@ -250,39 +250,39 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setAlpha($pValue = 0) {
- $this->_alpha = $pValue;
- return $this;
+ $this->_alpha = $pValue;
+ return $this;
}
- /**
- * Get hash code
- *
- * @return string Hash code
- */
- public function getHashCode() {
- return md5(
- ($this->_visible ? 't' : 'f')
- . $this->_blurRadius
- . $this->_distance
- . $this->_direction
- . $this->_alignment
- . $this->_color->getHashCode()
- . $this->_alpha
- . __CLASS__
- );
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode() {
+ return md5(
+ ($this->_visible ? 't' : 'f')
+ . $this->_blurRadius
+ . $this->_distance
+ . $this->_direction
+ . $this->_alignment
+ . $this->_color->getHashCode()
+ . $this->_alpha
+ . __CLASS__
+ );
}
- /**
- * Implement PHP __clone to create a deep clone, not just a shallow copy.
- */
- public function __clone() {
- $vars = get_object_vars($this);
- foreach ($vars as $key => $value) {
- if (is_object($value)) {
- $this->$key = clone $value;
- } else {
- $this->$key = $value;
- }
- }
- }
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone() {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
}
diff --git a/Classes/PHPExcel/Worksheet/HeaderFooter.php b/Classes/PHPExcel/Worksheet/HeaderFooter.php
index 6620682f..3d2271ab 100644
--- a/Classes/PHPExcel/Worksheet/HeaderFooter.php
+++ b/Classes/PHPExcel/Worksheet/HeaderFooter.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
@@ -37,7 +37,7 @@
*
* Example: This example shows the text "Center Bold Header" on the first line (center section), and the date on
* the second line (center section).
- * &CCenter &"-,Bold"Bold&"-,Regular"Header_x000A_&D
+ * &CCenter &"-,Bold"Bold&"-,Regular"Header_x000A_&D
*
* General Rules:
* There is no required order in which these codes must appear.
@@ -95,90 +95,90 @@
*/
class PHPExcel_Worksheet_HeaderFooter
{
- /* Header/footer image location */
- const IMAGE_HEADER_LEFT = 'LH';
- const IMAGE_HEADER_CENTER = 'CH';
- const IMAGE_HEADER_RIGHT = 'RH';
- const IMAGE_FOOTER_LEFT = 'LF';
- const IMAGE_FOOTER_CENTER = 'CF';
- const IMAGE_FOOTER_RIGHT = 'RF';
+ /* Header/footer image location */
+ const IMAGE_HEADER_LEFT = 'LH';
+ const IMAGE_HEADER_CENTER = 'CH';
+ const IMAGE_HEADER_RIGHT = 'RH';
+ const IMAGE_FOOTER_LEFT = 'LF';
+ const IMAGE_FOOTER_CENTER = 'CF';
+ const IMAGE_FOOTER_RIGHT = 'RF';
- /**
- * OddHeader
- *
- * @var string
- */
- private $_oddHeader = '';
+ /**
+ * OddHeader
+ *
+ * @var string
+ */
+ private $_oddHeader = '';
- /**
- * OddFooter
- *
- * @var string
- */
- private $_oddFooter = '';
+ /**
+ * OddFooter
+ *
+ * @var string
+ */
+ private $_oddFooter = '';
- /**
- * EvenHeader
- *
- * @var string
- */
- private $_evenHeader = '';
+ /**
+ * EvenHeader
+ *
+ * @var string
+ */
+ private $_evenHeader = '';
- /**
- * EvenFooter
- *
- * @var string
- */
- private $_evenFooter = '';
+ /**
+ * EvenFooter
+ *
+ * @var string
+ */
+ private $_evenFooter = '';
- /**
- * FirstHeader
- *
- * @var string
- */
- private $_firstHeader = '';
+ /**
+ * FirstHeader
+ *
+ * @var string
+ */
+ private $_firstHeader = '';
- /**
- * FirstFooter
- *
- * @var string
- */
- private $_firstFooter = '';
+ /**
+ * FirstFooter
+ *
+ * @var string
+ */
+ private $_firstFooter = '';
- /**
- * Different header for Odd/Even, defaults to false
- *
- * @var boolean
- */
- private $_differentOddEven = false;
+ /**
+ * Different header for Odd/Even, defaults to false
+ *
+ * @var boolean
+ */
+ private $_differentOddEven = false;
- /**
- * Different header for first page, defaults to false
- *
- * @var boolean
- */
- private $_differentFirst = false;
+ /**
+ * Different header for first page, defaults to false
+ *
+ * @var boolean
+ */
+ private $_differentFirst = false;
- /**
- * Scale with document, defaults to true
- *
- * @var boolean
- */
- private $_scaleWithDocument = true;
+ /**
+ * Scale with document, defaults to true
+ *
+ * @var boolean
+ */
+ private $_scaleWithDocument = true;
- /**
- * Align with margins, defaults to true
- *
- * @var boolean
- */
- private $_alignWithMargins = true;
+ /**
+ * Align with margins, defaults to true
+ *
+ * @var boolean
+ */
+ private $_alignWithMargins = true;
- /**
- * Header/footer images
- *
- * @var PHPExcel_Worksheet_HeaderFooterDrawing[]
- */
- private $_headerFooterImages = array();
+ /**
+ * Header/footer images
+ *
+ * @var PHPExcel_Worksheet_HeaderFooterDrawing[]
+ */
+ private $_headerFooterImages = array();
/**
* Create a new PHPExcel_Worksheet_HeaderFooter
@@ -193,7 +193,7 @@ class PHPExcel_Worksheet_HeaderFooter
* @return string
*/
public function getOddHeader() {
- return $this->_oddHeader;
+ return $this->_oddHeader;
}
/**
@@ -203,8 +203,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setOddHeader($pValue) {
- $this->_oddHeader = $pValue;
- return $this;
+ $this->_oddHeader = $pValue;
+ return $this;
}
/**
@@ -213,7 +213,7 @@ class PHPExcel_Worksheet_HeaderFooter
* @return string
*/
public function getOddFooter() {
- return $this->_oddFooter;
+ return $this->_oddFooter;
}
/**
@@ -223,8 +223,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setOddFooter($pValue) {
- $this->_oddFooter = $pValue;
- return $this;
+ $this->_oddFooter = $pValue;
+ return $this;
}
/**
@@ -233,7 +233,7 @@ class PHPExcel_Worksheet_HeaderFooter
* @return string
*/
public function getEvenHeader() {
- return $this->_evenHeader;
+ return $this->_evenHeader;
}
/**
@@ -243,8 +243,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setEvenHeader($pValue) {
- $this->_evenHeader = $pValue;
- return $this;
+ $this->_evenHeader = $pValue;
+ return $this;
}
/**
@@ -253,7 +253,7 @@ class PHPExcel_Worksheet_HeaderFooter
* @return string
*/
public function getEvenFooter() {
- return $this->_evenFooter;
+ return $this->_evenFooter;
}
/**
@@ -263,8 +263,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setEvenFooter($pValue) {
- $this->_evenFooter = $pValue;
- return $this;
+ $this->_evenFooter = $pValue;
+ return $this;
}
/**
@@ -273,7 +273,7 @@ class PHPExcel_Worksheet_HeaderFooter
* @return string
*/
public function getFirstHeader() {
- return $this->_firstHeader;
+ return $this->_firstHeader;
}
/**
@@ -283,8 +283,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setFirstHeader($pValue) {
- $this->_firstHeader = $pValue;
- return $this;
+ $this->_firstHeader = $pValue;
+ return $this;
}
/**
@@ -293,7 +293,7 @@ class PHPExcel_Worksheet_HeaderFooter
* @return string
*/
public function getFirstFooter() {
- return $this->_firstFooter;
+ return $this->_firstFooter;
}
/**
@@ -303,8 +303,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setFirstFooter($pValue) {
- $this->_firstFooter = $pValue;
- return $this;
+ $this->_firstFooter = $pValue;
+ return $this;
}
/**
@@ -313,7 +313,7 @@ class PHPExcel_Worksheet_HeaderFooter
* @return boolean
*/
public function getDifferentOddEven() {
- return $this->_differentOddEven;
+ return $this->_differentOddEven;
}
/**
@@ -323,8 +323,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setDifferentOddEven($pValue = false) {
- $this->_differentOddEven = $pValue;
- return $this;
+ $this->_differentOddEven = $pValue;
+ return $this;
}
/**
@@ -333,7 +333,7 @@ class PHPExcel_Worksheet_HeaderFooter
* @return boolean
*/
public function getDifferentFirst() {
- return $this->_differentFirst;
+ return $this->_differentFirst;
}
/**
@@ -343,8 +343,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setDifferentFirst($pValue = false) {
- $this->_differentFirst = $pValue;
- return $this;
+ $this->_differentFirst = $pValue;
+ return $this;
}
/**
@@ -353,7 +353,7 @@ class PHPExcel_Worksheet_HeaderFooter
* @return boolean
*/
public function getScaleWithDocument() {
- return $this->_scaleWithDocument;
+ return $this->_scaleWithDocument;
}
/**
@@ -363,8 +363,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setScaleWithDocument($pValue = true) {
- $this->_scaleWithDocument = $pValue;
- return $this;
+ $this->_scaleWithDocument = $pValue;
+ return $this;
}
/**
@@ -373,7 +373,7 @@ class PHPExcel_Worksheet_HeaderFooter
* @return boolean
*/
public function getAlignWithMargins() {
- return $this->_alignWithMargins;
+ return $this->_alignWithMargins;
}
/**
@@ -383,8 +383,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setAlignWithMargins($pValue = true) {
- $this->_alignWithMargins = $pValue;
- return $this;
+ $this->_alignWithMargins = $pValue;
+ return $this;
}
/**
@@ -396,8 +396,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT) {
- $this->_headerFooterImages[$location] = $image;
- return $this;
+ $this->_headerFooterImages[$location] = $image;
+ return $this;
}
/**
@@ -408,10 +408,10 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function removeImage($location = self::IMAGE_HEADER_LEFT) {
- if (isset($this->_headerFooterImages[$location])) {
- unset($this->_headerFooterImages[$location]);
- }
- return $this;
+ if (isset($this->_headerFooterImages[$location])) {
+ unset($this->_headerFooterImages[$location]);
+ }
+ return $this;
}
/**
@@ -422,12 +422,12 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setImages($images) {
- if (!is_array($images)) {
- throw new PHPExcel_Exception('Invalid parameter!');
- }
+ if (!is_array($images)) {
+ throw new PHPExcel_Exception('Invalid parameter!');
+ }
- $this->_headerFooterImages = $images;
- return $this;
+ $this->_headerFooterImages = $images;
+ return $this;
}
/**
@@ -436,30 +436,30 @@ class PHPExcel_Worksheet_HeaderFooter
* @return PHPExcel_Worksheet_HeaderFooterDrawing[]
*/
public function getImages() {
- // Sort array
- $images = array();
- if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) $images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT];
- if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) $images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER];
- if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) $images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT];
- if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) $images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT];
- if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) $images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER];
- if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) $images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT];
- $this->_headerFooterImages = $images;
+ // Sort array
+ $images = array();
+ if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) $images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT];
+ if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) $images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER];
+ if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) $images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT];
+ if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) $images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT];
+ if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) $images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER];
+ if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) $images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT];
+ $this->_headerFooterImages = $images;
- return $this->_headerFooterImages;
+ return $this->_headerFooterImages;
}
- /**
- * Implement PHP __clone to create a deep clone, not just a shallow copy.
- */
- public function __clone() {
- $vars = get_object_vars($this);
- foreach ($vars as $key => $value) {
- if (is_object($value)) {
- $this->$key = clone $value;
- } else {
- $this->$key = $value;
- }
- }
- }
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone() {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
}
diff --git a/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php b/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php
index 99085b73..6468d4f3 100644
--- a/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php
+++ b/Classes/PHPExcel/Worksheet/HeaderFooterDrawing.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
@@ -35,68 +35,68 @@
*/
class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing implements PHPExcel_IComparable
{
- /**
- * Path
- *
- * @var string
- */
- private $_path;
+ /**
+ * Path
+ *
+ * @var string
+ */
+ private $_path;
- /**
- * Name
- *
- * @var string
- */
- protected $_name;
+ /**
+ * Name
+ *
+ * @var string
+ */
+ protected $_name;
- /**
- * Offset X
- *
- * @var int
- */
- protected $_offsetX;
+ /**
+ * Offset X
+ *
+ * @var int
+ */
+ protected $_offsetX;
- /**
- * Offset Y
- *
- * @var int
- */
- protected $_offsetY;
+ /**
+ * Offset Y
+ *
+ * @var int
+ */
+ protected $_offsetY;
- /**
- * Width
- *
- * @var int
- */
- protected $_width;
+ /**
+ * Width
+ *
+ * @var int
+ */
+ protected $_width;
- /**
- * Height
- *
- * @var int
- */
- protected $_height;
+ /**
+ * Height
+ *
+ * @var int
+ */
+ protected $_height;
- /**
- * Proportional resize
- *
- * @var boolean
- */
- protected $_resizeProportional;
+ /**
+ * Proportional resize
+ *
+ * @var boolean
+ */
+ protected $_resizeProportional;
/**
* Create a new PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function __construct()
{
- // Initialise values
- $this->_path = '';
- $this->_name = '';
- $this->_offsetX = 0;
- $this->_offsetY = 0;
- $this->_width = 0;
- $this->_height = 0;
- $this->_resizeProportional = true;
+ // Initialise values
+ $this->_path = '';
+ $this->_name = '';
+ $this->_offsetX = 0;
+ $this->_offsetY = 0;
+ $this->_width = 0;
+ $this->_height = 0;
+ $this->_resizeProportional = true;
}
/**
@@ -105,7 +105,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return string
*/
public function getName() {
- return $this->_name;
+ return $this->_name;
}
/**
@@ -115,8 +115,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setName($pValue = '') {
- $this->_name = $pValue;
- return $this;
+ $this->_name = $pValue;
+ return $this;
}
/**
@@ -125,7 +125,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return int
*/
public function getOffsetX() {
- return $this->_offsetX;
+ return $this->_offsetX;
}
/**
@@ -135,8 +135,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setOffsetX($pValue = 0) {
- $this->_offsetX = $pValue;
- return $this;
+ $this->_offsetX = $pValue;
+ return $this;
}
/**
@@ -145,7 +145,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return int
*/
public function getOffsetY() {
- return $this->_offsetY;
+ return $this->_offsetY;
}
/**
@@ -155,8 +155,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setOffsetY($pValue = 0) {
- $this->_offsetY = $pValue;
- return $this;
+ $this->_offsetY = $pValue;
+ return $this;
}
/**
@@ -165,7 +165,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return int
*/
public function getWidth() {
- return $this->_width;
+ return $this->_width;
}
/**
@@ -175,16 +175,16 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setWidth($pValue = 0) {
- // Resize proportional?
- if ($this->_resizeProportional && $pValue != 0) {
- $ratio = $this->_width / $this->_height;
- $this->_height = round($ratio * $pValue);
- }
+ // Resize proportional?
+ if ($this->_resizeProportional && $pValue != 0) {
+ $ratio = $this->_width / $this->_height;
+ $this->_height = round($ratio * $pValue);
+ }
- // Set width
- $this->_width = $pValue;
+ // Set width
+ $this->_width = $pValue;
- return $this;
+ return $this;
}
/**
@@ -193,7 +193,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return int
*/
public function getHeight() {
- return $this->_height;
+ return $this->_height;
}
/**
@@ -203,45 +203,45 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setHeight($pValue = 0) {
- // Resize proportional?
- if ($this->_resizeProportional && $pValue != 0) {
- $ratio = $this->_width / $this->_height;
- $this->_width = round($ratio * $pValue);
- }
+ // Resize proportional?
+ if ($this->_resizeProportional && $pValue != 0) {
+ $ratio = $this->_width / $this->_height;
+ $this->_width = round($ratio * $pValue);
+ }
- // Set height
- $this->_height = $pValue;
+ // Set height
+ $this->_height = $pValue;
- return $this;
+ return $this;
}
/**
* Set width and height with proportional resize
- * Example:
- *
+ * Example:
+ *
+ *
* @author Vincent@luo MSN:kele_100@hotmail.com
* @param int $width
* @param int $height
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
- public function setWidthAndHeight($width = 0, $height = 0) {
- $xratio = $width / $this->_width;
- $yratio = $height / $this->_height;
- if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
- if (($xratio * $this->_height) < $height) {
- $this->_height = ceil($xratio * $this->_height);
- $this->_width = $width;
- } else {
- $this->_width = ceil($yratio * $this->_width);
- $this->_height = $height;
- }
- }
- return $this;
- }
+ public function setWidthAndHeight($width = 0, $height = 0) {
+ $xratio = $width / $this->_width;
+ $yratio = $height / $this->_height;
+ if ($this->_resizeProportional && !($width == 0 || $height == 0)) {
+ if (($xratio * $this->_height) < $height) {
+ $this->_height = ceil($xratio * $this->_height);
+ $this->_width = $width;
+ } else {
+ $this->_width = ceil($yratio * $this->_width);
+ $this->_height = $height;
+ }
+ }
+ return $this;
+ }
/**
* Get ResizeProportional
@@ -249,7 +249,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return boolean
*/
public function getResizeProportional() {
- return $this->_resizeProportional;
+ return $this->_resizeProportional;
}
/**
@@ -259,8 +259,8 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setResizeProportional($pValue = true) {
- $this->_resizeProportional = $pValue;
- return $this;
+ $this->_resizeProportional = $pValue;
+ return $this;
}
/**
@@ -269,7 +269,7 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return string
*/
public function getFilename() {
- return basename($this->_path);
+ return basename($this->_path);
}
/**
@@ -288,63 +288,63 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
* @return string
*/
public function getPath() {
- return $this->_path;
+ return $this->_path;
}
/**
* Set Path
*
- * @param string $pValue File path
- * @param boolean $pVerifyFile Verify file
- * @throws PHPExcel_Exception
+ * @param string $pValue File path
+ * @param boolean $pVerifyFile Verify file
+ * @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooterDrawing
*/
public function setPath($pValue = '', $pVerifyFile = true) {
- if ($pVerifyFile) {
- if (file_exists($pValue)) {
- $this->_path = $pValue;
+ if ($pVerifyFile) {
+ if (file_exists($pValue)) {
+ $this->_path = $pValue;
- if ($this->_width == 0 && $this->_height == 0) {
- // Get width/height
- list($this->_width, $this->_height) = getimagesize($pValue);
- }
- } else {
- throw new PHPExcel_Exception("File $pValue not found!");
- }
- } else {
- $this->_path = $pValue;
- }
- return $this;
+ if ($this->_width == 0 && $this->_height == 0) {
+ // Get width/height
+ list($this->_width, $this->_height) = getimagesize($pValue);
+ }
+ } else {
+ throw new PHPExcel_Exception("File $pValue not found!");
+ }
+ } else {
+ $this->_path = $pValue;
+ }
+ return $this;
}
- /**
- * Get hash code
- *
- * @return string Hash code
- */
- public function getHashCode() {
- return md5(
- $this->_path
- . $this->_name
- . $this->_offsetX
- . $this->_offsetY
- . $this->_width
- . $this->_height
- . __CLASS__
- );
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode() {
+ return md5(
+ $this->_path
+ . $this->_name
+ . $this->_offsetX
+ . $this->_offsetY
+ . $this->_width
+ . $this->_height
+ . __CLASS__
+ );
}
- /**
- * Implement PHP __clone to create a deep clone, not just a shallow copy.
- */
- public function __clone() {
- $vars = get_object_vars($this);
- foreach ($vars as $key => $value) {
- if (is_object($value)) {
- $this->$key = clone $value;
- } else {
- $this->$key = $value;
- }
- }
- }
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone() {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
}
diff --git a/Classes/PHPExcel/Worksheet/MemoryDrawing.php b/Classes/PHPExcel/Worksheet/MemoryDrawing.php
index b6c71af9..86fc681e 100644
--- a/Classes/PHPExcel/Worksheet/MemoryDrawing.php
+++ b/Classes/PHPExcel/Worksheet/MemoryDrawing.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
@@ -35,59 +35,59 @@
*/
class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
{
- /* Rendering functions */
- const RENDERING_DEFAULT = 'imagepng';
- const RENDERING_PNG = 'imagepng';
- const RENDERING_GIF = 'imagegif';
- const RENDERING_JPEG = 'imagejpeg';
+ /* Rendering functions */
+ const RENDERING_DEFAULT = 'imagepng';
+ const RENDERING_PNG = 'imagepng';
+ const RENDERING_GIF = 'imagegif';
+ const RENDERING_JPEG = 'imagejpeg';
- /* MIME types */
- const MIMETYPE_DEFAULT = 'image/png';
- const MIMETYPE_PNG = 'image/png';
- const MIMETYPE_GIF = 'image/gif';
- const MIMETYPE_JPEG = 'image/jpeg';
+ /* MIME types */
+ const MIMETYPE_DEFAULT = 'image/png';
+ const MIMETYPE_PNG = 'image/png';
+ const MIMETYPE_GIF = 'image/gif';
+ const MIMETYPE_JPEG = 'image/jpeg';
- /**
- * Image resource
- *
- * @var resource
- */
- private $_imageResource;
+ /**
+ * Image resource
+ *
+ * @var resource
+ */
+ private $_imageResource;
- /**
- * Rendering function
- *
- * @var string
- */
- private $_renderingFunction;
+ /**
+ * Rendering function
+ *
+ * @var string
+ */
+ private $_renderingFunction;
- /**
- * Mime type
- *
- * @var string
- */
- private $_mimeType;
+ /**
+ * Mime type
+ *
+ * @var string
+ */
+ private $_mimeType;
- /**
- * Unique name
- *
- * @var string
- */
- private $_uniqueName;
+ /**
+ * Unique name
+ *
+ * @var string
+ */
+ private $_uniqueName;
/**
* Create a new PHPExcel_Worksheet_MemoryDrawing
*/
public function __construct()
{
- // Initialise values
- $this->_imageResource = null;
- $this->_renderingFunction = self::RENDERING_DEFAULT;
- $this->_mimeType = self::MIMETYPE_DEFAULT;
- $this->_uniqueName = md5(rand(0, 9999). time() . rand(0, 9999));
+ // Initialise values
+ $this->_imageResource = null;
+ $this->_renderingFunction = self::RENDERING_DEFAULT;
+ $this->_mimeType = self::MIMETYPE_DEFAULT;
+ $this->_uniqueName = md5(rand(0, 9999). time() . rand(0, 9999));
- // Initialize parent
- parent::__construct();
+ // Initialize parent
+ parent::__construct();
}
/**
@@ -96,24 +96,24 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
* @return resource
*/
public function getImageResource() {
- return $this->_imageResource;
+ return $this->_imageResource;
}
/**
* Set image resource
*
- * @param $value resource
+ * @param $value resource
* @return PHPExcel_Worksheet_MemoryDrawing
*/
public function setImageResource($value = null) {
- $this->_imageResource = $value;
+ $this->_imageResource = $value;
- if (!is_null($this->_imageResource)) {
- // Get width/height
- $this->_width = imagesx($this->_imageResource);
- $this->_height = imagesy($this->_imageResource);
- }
- return $this;
+ if (!is_null($this->_imageResource)) {
+ // Get width/height
+ $this->_width = imagesx($this->_imageResource);
+ $this->_height = imagesy($this->_imageResource);
+ }
+ return $this;
}
/**
@@ -122,7 +122,7 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
* @return string
*/
public function getRenderingFunction() {
- return $this->_renderingFunction;
+ return $this->_renderingFunction;
}
/**
@@ -132,8 +132,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
* @return PHPExcel_Worksheet_MemoryDrawing
*/
public function setRenderingFunction($value = PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT) {
- $this->_renderingFunction = $value;
- return $this;
+ $this->_renderingFunction = $value;
+ return $this;
}
/**
@@ -142,7 +142,7 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
* @return string
*/
public function getMimeType() {
- return $this->_mimeType;
+ return $this->_mimeType;
}
/**
@@ -152,8 +152,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
* @return PHPExcel_Worksheet_MemoryDrawing
*/
public function setMimeType($value = PHPExcel_Worksheet_MemoryDrawing::MIMETYPE_DEFAULT) {
- $this->_mimeType = $value;
- return $this;
+ $this->_mimeType = $value;
+ return $this;
}
/**
@@ -162,39 +162,39 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
* @return string
*/
public function getIndexedFilename() {
- $extension = strtolower($this->getMimeType());
- $extension = explode('/', $extension);
- $extension = $extension[1];
+ $extension = strtolower($this->getMimeType());
+ $extension = explode('/', $extension);
+ $extension = $extension[1];
- return $this->_uniqueName . $this->getImageIndex() . '.' . $extension;
+ return $this->_uniqueName . $this->getImageIndex() . '.' . $extension;
}
- /**
- * Get hash code
- *
- * @return string Hash code
- */
- public function getHashCode() {
- return md5(
- $this->_renderingFunction
- . $this->_mimeType
- . $this->_uniqueName
- . parent::getHashCode()
- . __CLASS__
- );
+ /**
+ * Get hash code
+ *
+ * @return string Hash code
+ */
+ public function getHashCode() {
+ return md5(
+ $this->_renderingFunction
+ . $this->_mimeType
+ . $this->_uniqueName
+ . parent::getHashCode()
+ . __CLASS__
+ );
}
- /**
- * Implement PHP __clone to create a deep clone, not just a shallow copy.
- */
- public function __clone() {
- $vars = get_object_vars($this);
- foreach ($vars as $key => $value) {
- if (is_object($value)) {
- $this->$key = clone $value;
- } else {
- $this->$key = $value;
- }
- }
- }
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone() {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
}
diff --git a/Classes/PHPExcel/Worksheet/PageMargins.php b/Classes/PHPExcel/Worksheet/PageMargins.php
index 3b83afb5..38cbce6e 100644
--- a/Classes/PHPExcel/Worksheet/PageMargins.php
+++ b/Classes/PHPExcel/Worksheet/PageMargins.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
@@ -35,47 +35,47 @@
*/
class PHPExcel_Worksheet_PageMargins
{
- /**
- * Left
- *
- * @var double
- */
- private $_left = 0.7;
+ /**
+ * Left
+ *
+ * @var double
+ */
+ private $_left = 0.7;
- /**
- * Right
- *
- * @var double
- */
- private $_right = 0.7;
+ /**
+ * Right
+ *
+ * @var double
+ */
+ private $_right = 0.7;
- /**
- * Top
- *
- * @var double
- */
- private $_top = 0.75;
+ /**
+ * Top
+ *
+ * @var double
+ */
+ private $_top = 0.75;
- /**
- * Bottom
- *
- * @var double
- */
- private $_bottom = 0.75;
+ /**
+ * Bottom
+ *
+ * @var double
+ */
+ private $_bottom = 0.75;
- /**
- * Header
- *
- * @var double
- */
- private $_header = 0.3;
+ /**
+ * Header
+ *
+ * @var double
+ */
+ private $_header = 0.3;
- /**
- * Footer
- *
- * @var double
- */
- private $_footer = 0.3;
+ /**
+ * Footer
+ *
+ * @var double
+ */
+ private $_footer = 0.3;
/**
* Create a new PHPExcel_Worksheet_PageMargins
@@ -90,7 +90,7 @@ class PHPExcel_Worksheet_PageMargins
* @return double
*/
public function getLeft() {
- return $this->_left;
+ return $this->_left;
}
/**
@@ -100,8 +100,8 @@ class PHPExcel_Worksheet_PageMargins
* @return PHPExcel_Worksheet_PageMargins
*/
public function setLeft($pValue) {
- $this->_left = $pValue;
- return $this;
+ $this->_left = $pValue;
+ return $this;
}
/**
@@ -110,7 +110,7 @@ class PHPExcel_Worksheet_PageMargins
* @return double
*/
public function getRight() {
- return $this->_right;
+ return $this->_right;
}
/**
@@ -120,8 +120,8 @@ class PHPExcel_Worksheet_PageMargins
* @return PHPExcel_Worksheet_PageMargins
*/
public function setRight($pValue) {
- $this->_right = $pValue;
- return $this;
+ $this->_right = $pValue;
+ return $this;
}
/**
@@ -130,7 +130,7 @@ class PHPExcel_Worksheet_PageMargins
* @return double
*/
public function getTop() {
- return $this->_top;
+ return $this->_top;
}
/**
@@ -140,8 +140,8 @@ class PHPExcel_Worksheet_PageMargins
* @return PHPExcel_Worksheet_PageMargins
*/
public function setTop($pValue) {
- $this->_top = $pValue;
- return $this;
+ $this->_top = $pValue;
+ return $this;
}
/**
@@ -150,7 +150,7 @@ class PHPExcel_Worksheet_PageMargins
* @return double
*/
public function getBottom() {
- return $this->_bottom;
+ return $this->_bottom;
}
/**
@@ -160,8 +160,8 @@ class PHPExcel_Worksheet_PageMargins
* @return PHPExcel_Worksheet_PageMargins
*/
public function setBottom($pValue) {
- $this->_bottom = $pValue;
- return $this;
+ $this->_bottom = $pValue;
+ return $this;
}
/**
@@ -170,7 +170,7 @@ class PHPExcel_Worksheet_PageMargins
* @return double
*/
public function getHeader() {
- return $this->_header;
+ return $this->_header;
}
/**
@@ -180,8 +180,8 @@ class PHPExcel_Worksheet_PageMargins
* @return PHPExcel_Worksheet_PageMargins
*/
public function setHeader($pValue) {
- $this->_header = $pValue;
- return $this;
+ $this->_header = $pValue;
+ return $this;
}
/**
@@ -190,7 +190,7 @@ class PHPExcel_Worksheet_PageMargins
* @return double
*/
public function getFooter() {
- return $this->_footer;
+ return $this->_footer;
}
/**
@@ -200,21 +200,21 @@ class PHPExcel_Worksheet_PageMargins
* @return PHPExcel_Worksheet_PageMargins
*/
public function setFooter($pValue) {
- $this->_footer = $pValue;
- return $this;
+ $this->_footer = $pValue;
+ return $this;
}
- /**
- * Implement PHP __clone to create a deep clone, not just a shallow copy.
- */
- public function __clone() {
- $vars = get_object_vars($this);
- foreach ($vars as $key => $value) {
- if (is_object($value)) {
- $this->$key = clone $value;
- } else {
- $this->$key = $value;
- }
- }
- }
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone() {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
}
diff --git a/Classes/PHPExcel/Worksheet/PageSetup.php b/Classes/PHPExcel/Worksheet/PageSetup.php
index 86af283d..2070cf90 100644
--- a/Classes/PHPExcel/Worksheet/PageSetup.php
+++ b/Classes/PHPExcel/Worksheet/PageSetup.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
@@ -106,173 +106,173 @@
*/
class PHPExcel_Worksheet_PageSetup
{
- /* Paper size */
- const PAPERSIZE_LETTER = 1;
- const PAPERSIZE_LETTER_SMALL = 2;
- const PAPERSIZE_TABLOID = 3;
- const PAPERSIZE_LEDGER = 4;
- const PAPERSIZE_LEGAL = 5;
- const PAPERSIZE_STATEMENT = 6;
- const PAPERSIZE_EXECUTIVE = 7;
- const PAPERSIZE_A3 = 8;
- const PAPERSIZE_A4 = 9;
- const PAPERSIZE_A4_SMALL = 10;
- const PAPERSIZE_A5 = 11;
- const PAPERSIZE_B4 = 12;
- const PAPERSIZE_B5 = 13;
- const PAPERSIZE_FOLIO = 14;
- const PAPERSIZE_QUARTO = 15;
- const PAPERSIZE_STANDARD_1 = 16;
- const PAPERSIZE_STANDARD_2 = 17;
- const PAPERSIZE_NOTE = 18;
- const PAPERSIZE_NO9_ENVELOPE = 19;
- const PAPERSIZE_NO10_ENVELOPE = 20;
- const PAPERSIZE_NO11_ENVELOPE = 21;
- const PAPERSIZE_NO12_ENVELOPE = 22;
- const PAPERSIZE_NO14_ENVELOPE = 23;
- const PAPERSIZE_C = 24;
- const PAPERSIZE_D = 25;
- const PAPERSIZE_E = 26;
- const PAPERSIZE_DL_ENVELOPE = 27;
- const PAPERSIZE_C5_ENVELOPE = 28;
- const PAPERSIZE_C3_ENVELOPE = 29;
- const PAPERSIZE_C4_ENVELOPE = 30;
- const PAPERSIZE_C6_ENVELOPE = 31;
- const PAPERSIZE_C65_ENVELOPE = 32;
- const PAPERSIZE_B4_ENVELOPE = 33;
- const PAPERSIZE_B5_ENVELOPE = 34;
- const PAPERSIZE_B6_ENVELOPE = 35;
- const PAPERSIZE_ITALY_ENVELOPE = 36;
- const PAPERSIZE_MONARCH_ENVELOPE = 37;
- const PAPERSIZE_6_3_4_ENVELOPE = 38;
- const PAPERSIZE_US_STANDARD_FANFOLD = 39;
- const PAPERSIZE_GERMAN_STANDARD_FANFOLD = 40;
- const PAPERSIZE_GERMAN_LEGAL_FANFOLD = 41;
- const PAPERSIZE_ISO_B4 = 42;
- const PAPERSIZE_JAPANESE_DOUBLE_POSTCARD = 43;
- const PAPERSIZE_STANDARD_PAPER_1 = 44;
- const PAPERSIZE_STANDARD_PAPER_2 = 45;
- const PAPERSIZE_STANDARD_PAPER_3 = 46;
- const PAPERSIZE_INVITE_ENVELOPE = 47;
- const PAPERSIZE_LETTER_EXTRA_PAPER = 48;
- const PAPERSIZE_LEGAL_EXTRA_PAPER = 49;
- const PAPERSIZE_TABLOID_EXTRA_PAPER = 50;
- const PAPERSIZE_A4_EXTRA_PAPER = 51;
- const PAPERSIZE_LETTER_TRANSVERSE_PAPER = 52;
- const PAPERSIZE_A4_TRANSVERSE_PAPER = 53;
- const PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER = 54;
- const PAPERSIZE_SUPERA_SUPERA_A4_PAPER = 55;
- const PAPERSIZE_SUPERB_SUPERB_A3_PAPER = 56;
- const PAPERSIZE_LETTER_PLUS_PAPER = 57;
- const PAPERSIZE_A4_PLUS_PAPER = 58;
- const PAPERSIZE_A5_TRANSVERSE_PAPER = 59;
- const PAPERSIZE_JIS_B5_TRANSVERSE_PAPER = 60;
- const PAPERSIZE_A3_EXTRA_PAPER = 61;
- const PAPERSIZE_A5_EXTRA_PAPER = 62;
- const PAPERSIZE_ISO_B5_EXTRA_PAPER = 63;
- const PAPERSIZE_A2_PAPER = 64;
- const PAPERSIZE_A3_TRANSVERSE_PAPER = 65;
- const PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER = 66;
+ /* Paper size */
+ const PAPERSIZE_LETTER = 1;
+ const PAPERSIZE_LETTER_SMALL = 2;
+ const PAPERSIZE_TABLOID = 3;
+ const PAPERSIZE_LEDGER = 4;
+ const PAPERSIZE_LEGAL = 5;
+ const PAPERSIZE_STATEMENT = 6;
+ const PAPERSIZE_EXECUTIVE = 7;
+ const PAPERSIZE_A3 = 8;
+ const PAPERSIZE_A4 = 9;
+ const PAPERSIZE_A4_SMALL = 10;
+ const PAPERSIZE_A5 = 11;
+ const PAPERSIZE_B4 = 12;
+ const PAPERSIZE_B5 = 13;
+ const PAPERSIZE_FOLIO = 14;
+ const PAPERSIZE_QUARTO = 15;
+ const PAPERSIZE_STANDARD_1 = 16;
+ const PAPERSIZE_STANDARD_2 = 17;
+ const PAPERSIZE_NOTE = 18;
+ const PAPERSIZE_NO9_ENVELOPE = 19;
+ const PAPERSIZE_NO10_ENVELOPE = 20;
+ const PAPERSIZE_NO11_ENVELOPE = 21;
+ const PAPERSIZE_NO12_ENVELOPE = 22;
+ const PAPERSIZE_NO14_ENVELOPE = 23;
+ const PAPERSIZE_C = 24;
+ const PAPERSIZE_D = 25;
+ const PAPERSIZE_E = 26;
+ const PAPERSIZE_DL_ENVELOPE = 27;
+ const PAPERSIZE_C5_ENVELOPE = 28;
+ const PAPERSIZE_C3_ENVELOPE = 29;
+ const PAPERSIZE_C4_ENVELOPE = 30;
+ const PAPERSIZE_C6_ENVELOPE = 31;
+ const PAPERSIZE_C65_ENVELOPE = 32;
+ const PAPERSIZE_B4_ENVELOPE = 33;
+ const PAPERSIZE_B5_ENVELOPE = 34;
+ const PAPERSIZE_B6_ENVELOPE = 35;
+ const PAPERSIZE_ITALY_ENVELOPE = 36;
+ const PAPERSIZE_MONARCH_ENVELOPE = 37;
+ const PAPERSIZE_6_3_4_ENVELOPE = 38;
+ const PAPERSIZE_US_STANDARD_FANFOLD = 39;
+ const PAPERSIZE_GERMAN_STANDARD_FANFOLD = 40;
+ const PAPERSIZE_GERMAN_LEGAL_FANFOLD = 41;
+ const PAPERSIZE_ISO_B4 = 42;
+ const PAPERSIZE_JAPANESE_DOUBLE_POSTCARD = 43;
+ const PAPERSIZE_STANDARD_PAPER_1 = 44;
+ const PAPERSIZE_STANDARD_PAPER_2 = 45;
+ const PAPERSIZE_STANDARD_PAPER_3 = 46;
+ const PAPERSIZE_INVITE_ENVELOPE = 47;
+ const PAPERSIZE_LETTER_EXTRA_PAPER = 48;
+ const PAPERSIZE_LEGAL_EXTRA_PAPER = 49;
+ const PAPERSIZE_TABLOID_EXTRA_PAPER = 50;
+ const PAPERSIZE_A4_EXTRA_PAPER = 51;
+ const PAPERSIZE_LETTER_TRANSVERSE_PAPER = 52;
+ const PAPERSIZE_A4_TRANSVERSE_PAPER = 53;
+ const PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER = 54;
+ const PAPERSIZE_SUPERA_SUPERA_A4_PAPER = 55;
+ const PAPERSIZE_SUPERB_SUPERB_A3_PAPER = 56;
+ const PAPERSIZE_LETTER_PLUS_PAPER = 57;
+ const PAPERSIZE_A4_PLUS_PAPER = 58;
+ const PAPERSIZE_A5_TRANSVERSE_PAPER = 59;
+ const PAPERSIZE_JIS_B5_TRANSVERSE_PAPER = 60;
+ const PAPERSIZE_A3_EXTRA_PAPER = 61;
+ const PAPERSIZE_A5_EXTRA_PAPER = 62;
+ const PAPERSIZE_ISO_B5_EXTRA_PAPER = 63;
+ const PAPERSIZE_A2_PAPER = 64;
+ const PAPERSIZE_A3_TRANSVERSE_PAPER = 65;
+ const PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER = 66;
- /* Page orientation */
- const ORIENTATION_DEFAULT = 'default';
- const ORIENTATION_LANDSCAPE = 'landscape';
- const ORIENTATION_PORTRAIT = 'portrait';
+ /* Page orientation */
+ const ORIENTATION_DEFAULT = 'default';
+ const ORIENTATION_LANDSCAPE = 'landscape';
+ const ORIENTATION_PORTRAIT = 'portrait';
- /* Print Range Set Method */
- const SETPRINTRANGE_OVERWRITE = 'O';
- const SETPRINTRANGE_INSERT = 'I';
+ /* Print Range Set Method */
+ const SETPRINTRANGE_OVERWRITE = 'O';
+ const SETPRINTRANGE_INSERT = 'I';
- /**
- * Paper size
- *
- * @var int
- */
- private $_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
+ /**
+ * Paper size
+ *
+ * @var int
+ */
+ private $_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
- /**
- * Orientation
- *
- * @var string
- */
- private $_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
+ /**
+ * Orientation
+ *
+ * @var string
+ */
+ private $_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
- /**
- * Scale (Print Scale)
- *
- * Print scaling. Valid values range from 10 to 400
- * This setting is overridden when fitToWidth and/or fitToHeight are in use
- *
- * @var int?
- */
- private $_scale = 100;
+ /**
+ * Scale (Print Scale)
+ *
+ * Print scaling. Valid values range from 10 to 400
+ * This setting is overridden when fitToWidth and/or fitToHeight are in use
+ *
+ * @var int?
+ */
+ private $_scale = 100;
- /**
- * Fit To Page
- * Whether scale or fitToWith / fitToHeight applies
- *
- * @var boolean
- */
- private $_fitToPage = FALSE;
+ /**
+ * Fit To Page
+ * Whether scale or fitToWith / fitToHeight applies
+ *
+ * @var boolean
+ */
+ private $_fitToPage = FALSE;
- /**
- * Fit To Height
- * Number of vertical pages to fit on
- *
- * @var int?
- */
- private $_fitToHeight = 1;
+ /**
+ * Fit To Height
+ * Number of vertical pages to fit on
+ *
+ * @var int?
+ */
+ private $_fitToHeight = 1;
- /**
- * Fit To Width
- * Number of horizontal pages to fit on
- *
- * @var int?
- */
- private $_fitToWidth = 1;
+ /**
+ * Fit To Width
+ * Number of horizontal pages to fit on
+ *
+ * @var int?
+ */
+ private $_fitToWidth = 1;
- /**
- * Columns to repeat at left
- *
- * @var array Containing start column and end column, empty array if option unset
- */
- private $_columnsToRepeatAtLeft = array('', '');
+ /**
+ * Columns to repeat at left
+ *
+ * @var array Containing start column and end column, empty array if option unset
+ */
+ private $_columnsToRepeatAtLeft = array('', '');
- /**
- * Rows to repeat at top
- *
- * @var array Containing start row number and end row number, empty array if option unset
- */
- private $_rowsToRepeatAtTop = array(0, 0);
+ /**
+ * Rows to repeat at top
+ *
+ * @var array Containing start row number and end row number, empty array if option unset
+ */
+ private $_rowsToRepeatAtTop = array(0, 0);
- /**
- * Center page horizontally
- *
- * @var boolean
- */
- private $_horizontalCentered = FALSE;
+ /**
+ * Center page horizontally
+ *
+ * @var boolean
+ */
+ private $_horizontalCentered = FALSE;
- /**
- * Center page vertically
- *
- * @var boolean
- */
- private $_verticalCentered = FALSE;
+ /**
+ * Center page vertically
+ *
+ * @var boolean
+ */
+ private $_verticalCentered = FALSE;
- /**
- * Print area
- *
- * @var string
- */
- private $_printArea = NULL;
+ /**
+ * Print area
+ *
+ * @var string
+ */
+ private $_printArea = NULL;
- /**
- * First page number
- *
- * @var int
- */
- private $_firstPageNumber = NULL;
+ /**
+ * First page number
+ *
+ * @var int
+ */
+ private $_firstPageNumber = NULL;
/**
* Create a new PHPExcel_Worksheet_PageSetup
@@ -287,7 +287,7 @@ class PHPExcel_Worksheet_PageSetup
* @return int
*/
public function getPaperSize() {
- return $this->_paperSize;
+ return $this->_paperSize;
}
/**
@@ -297,8 +297,8 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup
*/
public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER) {
- $this->_paperSize = $pValue;
- return $this;
+ $this->_paperSize = $pValue;
+ return $this;
}
/**
@@ -307,7 +307,7 @@ class PHPExcel_Worksheet_PageSetup
* @return string
*/
public function getOrientation() {
- return $this->_orientation;
+ return $this->_orientation;
}
/**
@@ -317,449 +317,449 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup
*/
public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) {
- $this->_orientation = $pValue;
- return $this;
+ $this->_orientation = $pValue;
+ return $this;
}
- /**
- * Get Scale
- *
- * @return int?
- */
- public function getScale() {
- return $this->_scale;
- }
+ /**
+ * Get Scale
+ *
+ * @return int?
+ */
+ public function getScale() {
+ return $this->_scale;
+ }
- /**
- * Set Scale
- *
- * Print scaling. Valid values range from 10 to 400
- * This setting is overridden when fitToWidth and/or fitToHeight are in use
- *
- * @param int? $pValue
- * @param boolean $pUpdate Update fitToPage so scaling applies rather than fitToHeight / fitToWidth
- * @return PHPExcel_Worksheet_PageSetup
- * @throws PHPExcel_Exception
- */
- public function setScale($pValue = 100, $pUpdate = true) {
- // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
- // but it is apparently still able to handle any scale >= 0, where 0 results in 100
- if (($pValue >= 0) || is_null($pValue)) {
- $this->_scale = $pValue;
- if ($pUpdate) {
- $this->_fitToPage = false;
- }
- } else {
- throw new PHPExcel_Exception("Scale must not be negative");
- }
- return $this;
- }
+ /**
+ * Set Scale
+ *
+ * Print scaling. Valid values range from 10 to 400
+ * This setting is overridden when fitToWidth and/or fitToHeight are in use
+ *
+ * @param int? $pValue
+ * @param boolean $pUpdate Update fitToPage so scaling applies rather than fitToHeight / fitToWidth
+ * @return PHPExcel_Worksheet_PageSetup
+ * @throws PHPExcel_Exception
+ */
+ public function setScale($pValue = 100, $pUpdate = true) {
+ // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
+ // but it is apparently still able to handle any scale >= 0, where 0 results in 100
+ if (($pValue >= 0) || is_null($pValue)) {
+ $this->_scale = $pValue;
+ if ($pUpdate) {
+ $this->_fitToPage = false;
+ }
+ } else {
+ throw new PHPExcel_Exception("Scale must not be negative");
+ }
+ return $this;
+ }
- /**
- * Get Fit To Page
- *
- * @return boolean
- */
- public function getFitToPage() {
- return $this->_fitToPage;
- }
+ /**
+ * Get Fit To Page
+ *
+ * @return boolean
+ */
+ public function getFitToPage() {
+ return $this->_fitToPage;
+ }
- /**
- * Set Fit To Page
- *
- * @param boolean $pValue
- * @return PHPExcel_Worksheet_PageSetup
- */
- public function setFitToPage($pValue = TRUE) {
- $this->_fitToPage = $pValue;
- return $this;
- }
+ /**
+ * Set Fit To Page
+ *
+ * @param boolean $pValue
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setFitToPage($pValue = TRUE) {
+ $this->_fitToPage = $pValue;
+ return $this;
+ }
- /**
- * Get Fit To Height
- *
- * @return int?
- */
- public function getFitToHeight() {
- return $this->_fitToHeight;
- }
+ /**
+ * Get Fit To Height
+ *
+ * @return int?
+ */
+ public function getFitToHeight() {
+ return $this->_fitToHeight;
+ }
- /**
- * Set Fit To Height
- *
- * @param int? $pValue
- * @param boolean $pUpdate Update fitToPage so it applies rather than scaling
- * @return PHPExcel_Worksheet_PageSetup
- */
- public function setFitToHeight($pValue = 1, $pUpdate = TRUE) {
- $this->_fitToHeight = $pValue;
- if ($pUpdate) {
- $this->_fitToPage = TRUE;
- }
- return $this;
- }
+ /**
+ * Set Fit To Height
+ *
+ * @param int? $pValue
+ * @param boolean $pUpdate Update fitToPage so it applies rather than scaling
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setFitToHeight($pValue = 1, $pUpdate = TRUE) {
+ $this->_fitToHeight = $pValue;
+ if ($pUpdate) {
+ $this->_fitToPage = TRUE;
+ }
+ return $this;
+ }
- /**
- * Get Fit To Width
- *
- * @return int?
- */
- public function getFitToWidth() {
- return $this->_fitToWidth;
- }
+ /**
+ * Get Fit To Width
+ *
+ * @return int?
+ */
+ public function getFitToWidth() {
+ return $this->_fitToWidth;
+ }
- /**
- * Set Fit To Width
- *
- * @param int? $pValue
- * @param boolean $pUpdate Update fitToPage so it applies rather than scaling
- * @return PHPExcel_Worksheet_PageSetup
- */
- public function setFitToWidth($pValue = 1, $pUpdate = TRUE) {
- $this->_fitToWidth = $pValue;
- if ($pUpdate) {
- $this->_fitToPage = TRUE;
- }
- return $this;
- }
+ /**
+ * Set Fit To Width
+ *
+ * @param int? $pValue
+ * @param boolean $pUpdate Update fitToPage so it applies rather than scaling
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setFitToWidth($pValue = 1, $pUpdate = TRUE) {
+ $this->_fitToWidth = $pValue;
+ if ($pUpdate) {
+ $this->_fitToPage = TRUE;
+ }
+ return $this;
+ }
- /**
- * Is Columns to repeat at left set?
- *
- * @return boolean
- */
- public function isColumnsToRepeatAtLeftSet() {
- if (is_array($this->_columnsToRepeatAtLeft)) {
- if ($this->_columnsToRepeatAtLeft[0] != '' && $this->_columnsToRepeatAtLeft[1] != '') {
- return true;
- }
- }
+ /**
+ * Is Columns to repeat at left set?
+ *
+ * @return boolean
+ */
+ public function isColumnsToRepeatAtLeftSet() {
+ if (is_array($this->_columnsToRepeatAtLeft)) {
+ if ($this->_columnsToRepeatAtLeft[0] != '' && $this->_columnsToRepeatAtLeft[1] != '') {
+ return true;
+ }
+ }
- return false;
- }
+ return false;
+ }
- /**
- * Get Columns to repeat at left
- *
- * @return array Containing start column and end column, empty array if option unset
- */
- public function getColumnsToRepeatAtLeft() {
- return $this->_columnsToRepeatAtLeft;
- }
+ /**
+ * Get Columns to repeat at left
+ *
+ * @return array Containing start column and end column, empty array if option unset
+ */
+ public function getColumnsToRepeatAtLeft() {
+ return $this->_columnsToRepeatAtLeft;
+ }
- /**
- * Set Columns to repeat at left
- *
- * @param array $pValue Containing start column and end column, empty array if option unset
- * @return PHPExcel_Worksheet_PageSetup
- */
- public function setColumnsToRepeatAtLeft($pValue = null) {
- if (is_array($pValue)) {
- $this->_columnsToRepeatAtLeft = $pValue;
- }
- return $this;
- }
+ /**
+ * Set Columns to repeat at left
+ *
+ * @param array $pValue Containing start column and end column, empty array if option unset
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setColumnsToRepeatAtLeft($pValue = null) {
+ if (is_array($pValue)) {
+ $this->_columnsToRepeatAtLeft = $pValue;
+ }
+ return $this;
+ }
- /**
- * Set Columns to repeat at left by start and end
- *
- * @param string $pStart
- * @param string $pEnd
- * @return PHPExcel_Worksheet_PageSetup
- */
- public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A') {
- $this->_columnsToRepeatAtLeft = array($pStart, $pEnd);
- return $this;
- }
+ /**
+ * Set Columns to repeat at left by start and end
+ *
+ * @param string $pStart
+ * @param string $pEnd
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A') {
+ $this->_columnsToRepeatAtLeft = array($pStart, $pEnd);
+ return $this;
+ }
- /**
- * Is Rows to repeat at top set?
- *
- * @return boolean
- */
- public function isRowsToRepeatAtTopSet() {
- if (is_array($this->_rowsToRepeatAtTop)) {
- if ($this->_rowsToRepeatAtTop[0] != 0 && $this->_rowsToRepeatAtTop[1] != 0) {
- return true;
- }
- }
+ /**
+ * Is Rows to repeat at top set?
+ *
+ * @return boolean
+ */
+ public function isRowsToRepeatAtTopSet() {
+ if (is_array($this->_rowsToRepeatAtTop)) {
+ if ($this->_rowsToRepeatAtTop[0] != 0 && $this->_rowsToRepeatAtTop[1] != 0) {
+ return true;
+ }
+ }
- return false;
- }
+ return false;
+ }
- /**
- * Get Rows to repeat at top
- *
- * @return array Containing start column and end column, empty array if option unset
- */
- public function getRowsToRepeatAtTop() {
- return $this->_rowsToRepeatAtTop;
- }
+ /**
+ * Get Rows to repeat at top
+ *
+ * @return array Containing start column and end column, empty array if option unset
+ */
+ public function getRowsToRepeatAtTop() {
+ return $this->_rowsToRepeatAtTop;
+ }
- /**
- * Set Rows to repeat at top
- *
- * @param array $pValue Containing start column and end column, empty array if option unset
- * @return PHPExcel_Worksheet_PageSetup
- */
- public function setRowsToRepeatAtTop($pValue = null) {
- if (is_array($pValue)) {
- $this->_rowsToRepeatAtTop = $pValue;
- }
- return $this;
- }
+ /**
+ * Set Rows to repeat at top
+ *
+ * @param array $pValue Containing start column and end column, empty array if option unset
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setRowsToRepeatAtTop($pValue = null) {
+ if (is_array($pValue)) {
+ $this->_rowsToRepeatAtTop = $pValue;
+ }
+ return $this;
+ }
- /**
- * Set Rows to repeat at top by start and end
- *
- * @param int $pStart
- * @param int $pEnd
- * @return PHPExcel_Worksheet_PageSetup
- */
- public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1) {
- $this->_rowsToRepeatAtTop = array($pStart, $pEnd);
- return $this;
- }
+ /**
+ * Set Rows to repeat at top by start and end
+ *
+ * @param int $pStart
+ * @param int $pEnd
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1) {
+ $this->_rowsToRepeatAtTop = array($pStart, $pEnd);
+ return $this;
+ }
- /**
- * Get center page horizontally
- *
- * @return bool
- */
- public function getHorizontalCentered() {
- return $this->_horizontalCentered;
- }
+ /**
+ * Get center page horizontally
+ *
+ * @return bool
+ */
+ public function getHorizontalCentered() {
+ return $this->_horizontalCentered;
+ }
- /**
- * Set center page horizontally
- *
- * @param bool $value
- * @return PHPExcel_Worksheet_PageSetup
- */
- public function setHorizontalCentered($value = false) {
- $this->_horizontalCentered = $value;
- return $this;
- }
+ /**
+ * Set center page horizontally
+ *
+ * @param bool $value
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setHorizontalCentered($value = false) {
+ $this->_horizontalCentered = $value;
+ return $this;
+ }
- /**
- * Get center page vertically
- *
- * @return bool
- */
- public function getVerticalCentered() {
- return $this->_verticalCentered;
- }
+ /**
+ * Get center page vertically
+ *
+ * @return bool
+ */
+ public function getVerticalCentered() {
+ return $this->_verticalCentered;
+ }
- /**
- * Set center page vertically
- *
- * @param bool $value
- * @return PHPExcel_Worksheet_PageSetup
- */
- public function setVerticalCentered($value = false) {
- $this->_verticalCentered = $value;
- return $this;
- }
+ /**
+ * Set center page vertically
+ *
+ * @param bool $value
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function setVerticalCentered($value = false) {
+ $this->_verticalCentered = $value;
+ return $this;
+ }
- /**
- * Get print area
- *
- * @param int $index Identifier for a specific print area range if several ranges have been set
- * Default behaviour, or a index value of 0, will return all ranges as a comma-separated string
- * Otherwise, the specific range identified by the value of $index will be returned
- * Print areas are numbered from 1
- * @throws PHPExcel_Exception
- * @return string
- */
- public function getPrintArea($index = 0) {
- if ($index == 0) {
- return $this->_printArea;
- }
- $printAreas = explode(',',$this->_printArea);
- if (isset($printAreas[$index-1])) {
- return $printAreas[$index-1];
- }
- throw new PHPExcel_Exception("Requested Print Area does not exist");
- }
+ /**
+ * Get print area
+ *
+ * @param int $index Identifier for a specific print area range if several ranges have been set
+ * Default behaviour, or a index value of 0, will return all ranges as a comma-separated string
+ * Otherwise, the specific range identified by the value of $index will be returned
+ * Print areas are numbered from 1
+ * @throws PHPExcel_Exception
+ * @return string
+ */
+ public function getPrintArea($index = 0) {
+ if ($index == 0) {
+ return $this->_printArea;
+ }
+ $printAreas = explode(',',$this->_printArea);
+ if (isset($printAreas[$index-1])) {
+ return $printAreas[$index-1];
+ }
+ throw new PHPExcel_Exception("Requested Print Area does not exist");
+ }
- /**
- * Is print area set?
- *
- * @param int $index Identifier for a specific print area range if several ranges have been set
- * Default behaviour, or an index value of 0, will identify whether any print range is set
- * Otherwise, existence of the range identified by the value of $index will be returned
- * Print areas are numbered from 1
- * @return boolean
- */
- public function isPrintAreaSet($index = 0) {
- if ($index == 0) {
- return !is_null($this->_printArea);
- }
- $printAreas = explode(',',$this->_printArea);
- return isset($printAreas[$index-1]);
- }
+ /**
+ * Is print area set?
+ *
+ * @param int $index Identifier for a specific print area range if several ranges have been set
+ * Default behaviour, or an index value of 0, will identify whether any print range is set
+ * Otherwise, existence of the range identified by the value of $index will be returned
+ * Print areas are numbered from 1
+ * @return boolean
+ */
+ public function isPrintAreaSet($index = 0) {
+ if ($index == 0) {
+ return !is_null($this->_printArea);
+ }
+ $printAreas = explode(',',$this->_printArea);
+ return isset($printAreas[$index-1]);
+ }
- /**
- * Clear a print area
- *
- * @param int $index Identifier for a specific print area range if several ranges have been set
- * Default behaviour, or an index value of 0, will clear all print ranges that are set
- * Otherwise, the range identified by the value of $index will be removed from the series
- * Print areas are numbered from 1
- * @return PHPExcel_Worksheet_PageSetup
- */
- public function clearPrintArea($index = 0) {
- if ($index == 0) {
- $this->_printArea = NULL;
- } else {
- $printAreas = explode(',',$this->_printArea);
- if (isset($printAreas[$index-1])) {
- unset($printAreas[$index-1]);
- $this->_printArea = implode(',',$printAreas);
- }
- }
+ /**
+ * Clear a print area
+ *
+ * @param int $index Identifier for a specific print area range if several ranges have been set
+ * Default behaviour, or an index value of 0, will clear all print ranges that are set
+ * Otherwise, the range identified by the value of $index will be removed from the series
+ * Print areas are numbered from 1
+ * @return PHPExcel_Worksheet_PageSetup
+ */
+ public function clearPrintArea($index = 0) {
+ if ($index == 0) {
+ $this->_printArea = NULL;
+ } else {
+ $printAreas = explode(',',$this->_printArea);
+ if (isset($printAreas[$index-1])) {
+ unset($printAreas[$index-1]);
+ $this->_printArea = implode(',',$printAreas);
+ }
+ }
- return $this;
- }
+ return $this;
+ }
- /**
- * Set print area. e.g. 'A1:D10' or 'A1:D10,G5:M20'
- *
- * @param string $value
- * @param int $index Identifier for a specific print area range allowing several ranges to be set
- * When the method is "O"verwrite, then a positive integer index will overwrite that indexed
- * entry in the print areas list; a negative index value will identify which entry to
- * overwrite working bacward through the print area to the list, with the last entry as -1.
- * Specifying an index value of 0, will overwrite all existing print ranges.
- * When the method is "I"nsert, then a positive index will insert after that indexed entry in
- * the print areas list, while a negative index will insert before the indexed entry.
- * Specifying an index value of 0, will always append the new print range at the end of the
- * list.
- * Print areas are numbered from 1
- * @param string $method Determines the method used when setting multiple print areas
- * Default behaviour, or the "O" method, overwrites existing print area
- * The "I" method, inserts the new print area before any specified index, or at the end of the list
- * @return PHPExcel_Worksheet_PageSetup
- * @throws PHPExcel_Exception
- */
- public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) {
- if (strpos($value,'!') !== false) {
- throw new PHPExcel_Exception('Cell coordinate must not specify a worksheet.');
- } elseif (strpos($value,':') === false) {
- throw new PHPExcel_Exception('Cell coordinate must be a range of cells.');
- } elseif (strpos($value,'$') !== false) {
- throw new PHPExcel_Exception('Cell coordinate must not be absolute.');
- }
- $value = strtoupper($value);
+ /**
+ * Set print area. e.g. 'A1:D10' or 'A1:D10,G5:M20'
+ *
+ * @param string $value
+ * @param int $index Identifier for a specific print area range allowing several ranges to be set
+ * When the method is "O"verwrite, then a positive integer index will overwrite that indexed
+ * entry in the print areas list; a negative index value will identify which entry to
+ * overwrite working bacward through the print area to the list, with the last entry as -1.
+ * Specifying an index value of 0, will overwrite all existing print ranges.
+ * When the method is "I"nsert, then a positive index will insert after that indexed entry in
+ * the print areas list, while a negative index will insert before the indexed entry.
+ * Specifying an index value of 0, will always append the new print range at the end of the
+ * list.
+ * Print areas are numbered from 1
+ * @param string $method Determines the method used when setting multiple print areas
+ * Default behaviour, or the "O" method, overwrites existing print area
+ * The "I" method, inserts the new print area before any specified index, or at the end of the list
+ * @return PHPExcel_Worksheet_PageSetup
+ * @throws PHPExcel_Exception
+ */
+ public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) {
+ if (strpos($value,'!') !== false) {
+ throw new PHPExcel_Exception('Cell coordinate must not specify a worksheet.');
+ } elseif (strpos($value,':') === false) {
+ throw new PHPExcel_Exception('Cell coordinate must be a range of cells.');
+ } elseif (strpos($value,'$') !== false) {
+ throw new PHPExcel_Exception('Cell coordinate must not be absolute.');
+ }
+ $value = strtoupper($value);
- if ($method == self::SETPRINTRANGE_OVERWRITE) {
- if ($index == 0) {
- $this->_printArea = $value;
- } else {
- $printAreas = explode(',',$this->_printArea);
- if($index < 0) {
- $index = count($printAreas) - abs($index) + 1;
- }
- if (($index <= 0) || ($index > count($printAreas))) {
- throw new PHPExcel_Exception('Invalid index for setting print range.');
- }
- $printAreas[$index-1] = $value;
- $this->_printArea = implode(',',$printAreas);
- }
- } elseif($method == self::SETPRINTRANGE_INSERT) {
- if ($index == 0) {
- $this->_printArea .= ($this->_printArea == '') ? $value : ','.$value;
- } else {
- $printAreas = explode(',',$this->_printArea);
- if($index < 0) {
- $index = abs($index) - 1;
- }
- if ($index > count($printAreas)) {
- throw new PHPExcel_Exception('Invalid index for setting print range.');
- }
- $printAreas = array_merge(array_slice($printAreas,0,$index),array($value),array_slice($printAreas,$index));
- $this->_printArea = implode(',',$printAreas);
- }
- } else {
- throw new PHPExcel_Exception('Invalid method for setting print range.');
- }
+ if ($method == self::SETPRINTRANGE_OVERWRITE) {
+ if ($index == 0) {
+ $this->_printArea = $value;
+ } else {
+ $printAreas = explode(',',$this->_printArea);
+ if($index < 0) {
+ $index = count($printAreas) - abs($index) + 1;
+ }
+ if (($index <= 0) || ($index > count($printAreas))) {
+ throw new PHPExcel_Exception('Invalid index for setting print range.');
+ }
+ $printAreas[$index-1] = $value;
+ $this->_printArea = implode(',',$printAreas);
+ }
+ } elseif($method == self::SETPRINTRANGE_INSERT) {
+ if ($index == 0) {
+ $this->_printArea .= ($this->_printArea == '') ? $value : ','.$value;
+ } else {
+ $printAreas = explode(',',$this->_printArea);
+ if($index < 0) {
+ $index = abs($index) - 1;
+ }
+ if ($index > count($printAreas)) {
+ throw new PHPExcel_Exception('Invalid index for setting print range.');
+ }
+ $printAreas = array_merge(array_slice($printAreas,0,$index),array($value),array_slice($printAreas,$index));
+ $this->_printArea = implode(',',$printAreas);
+ }
+ } else {
+ throw new PHPExcel_Exception('Invalid method for setting print range.');
+ }
- return $this;
- }
+ return $this;
+ }
- /**
- * Add a new print area (e.g. 'A1:D10' or 'A1:D10,G5:M20') to the list of print areas
- *
- * @param string $value
- * @param int $index Identifier for a specific print area range allowing several ranges to be set
- * A positive index will insert after that indexed entry in the print areas list, while a
- * negative index will insert before the indexed entry.
- * Specifying an index value of 0, will always append the new print range at the end of the
- * list.
- * Print areas are numbered from 1
- * @return PHPExcel_Worksheet_PageSetup
- * @throws PHPExcel_Exception
- */
- public function addPrintArea($value, $index = -1) {
- return $this->setPrintArea($value, $index, self::SETPRINTRANGE_INSERT);
- }
+ /**
+ * Add a new print area (e.g. 'A1:D10' or 'A1:D10,G5:M20') to the list of print areas
+ *
+ * @param string $value
+ * @param int $index Identifier for a specific print area range allowing several ranges to be set
+ * A positive index will insert after that indexed entry in the print areas list, while a
+ * negative index will insert before the indexed entry.
+ * Specifying an index value of 0, will always append the new print range at the end of the
+ * list.
+ * Print areas are numbered from 1
+ * @return PHPExcel_Worksheet_PageSetup
+ * @throws PHPExcel_Exception
+ */
+ public function addPrintArea($value, $index = -1) {
+ return $this->setPrintArea($value, $index, self::SETPRINTRANGE_INSERT);
+ }
- /**
- * Set print area
- *
- * @param int $column1 Column 1
- * @param int $row1 Row 1
- * @param int $column2 Column 2
- * @param int $row2 Row 2
- * @param int $index Identifier for a specific print area range allowing several ranges to be set
- * When the method is "O"verwrite, then a positive integer index will overwrite that indexed
- * entry in the print areas list; a negative index value will identify which entry to
- * overwrite working bacward through the print area to the list, with the last entry as -1.
- * Specifying an index value of 0, will overwrite all existing print ranges.
- * When the method is "I"nsert, then a positive index will insert after that indexed entry in
- * the print areas list, while a negative index will insert before the indexed entry.
- * Specifying an index value of 0, will always append the new print range at the end of the
- * list.
- * Print areas are numbered from 1
- * @param string $method Determines the method used when setting multiple print areas
- * Default behaviour, or the "O" method, overwrites existing print area
- * The "I" method, inserts the new print area before any specified index, or at the end of the list
- * @return PHPExcel_Worksheet_PageSetup
- * @throws PHPExcel_Exception
- */
+ /**
+ * Set print area
+ *
+ * @param int $column1 Column 1
+ * @param int $row1 Row 1
+ * @param int $column2 Column 2
+ * @param int $row2 Row 2
+ * @param int $index Identifier for a specific print area range allowing several ranges to be set
+ * When the method is "O"verwrite, then a positive integer index will overwrite that indexed
+ * entry in the print areas list; a negative index value will identify which entry to
+ * overwrite working bacward through the print area to the list, with the last entry as -1.
+ * Specifying an index value of 0, will overwrite all existing print ranges.
+ * When the method is "I"nsert, then a positive index will insert after that indexed entry in
+ * the print areas list, while a negative index will insert before the indexed entry.
+ * Specifying an index value of 0, will always append the new print range at the end of the
+ * list.
+ * Print areas are numbered from 1
+ * @param string $method Determines the method used when setting multiple print areas
+ * Default behaviour, or the "O" method, overwrites existing print area
+ * The "I" method, inserts the new print area before any specified index, or at the end of the list
+ * @return PHPExcel_Worksheet_PageSetup
+ * @throws PHPExcel_Exception
+ */
public function setPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
{
- return $this->setPrintArea(PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2, $index, $method);
+ return $this->setPrintArea(PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2, $index, $method);
}
- /**
- * Add a new print area to the list of print areas
- *
- * @param int $column1 Start Column for the print area
- * @param int $row1 Start Row for the print area
- * @param int $column2 End Column for the print area
- * @param int $row2 End Row for the print area
- * @param int $index Identifier for a specific print area range allowing several ranges to be set
- * A positive index will insert after that indexed entry in the print areas list, while a
- * negative index will insert before the indexed entry.
- * Specifying an index value of 0, will always append the new print range at the end of the
- * list.
- * Print areas are numbered from 1
- * @return PHPExcel_Worksheet_PageSetup
- * @throws PHPExcel_Exception
- */
+ /**
+ * Add a new print area to the list of print areas
+ *
+ * @param int $column1 Start Column for the print area
+ * @param int $row1 Start Row for the print area
+ * @param int $column2 End Column for the print area
+ * @param int $row2 End Row for the print area
+ * @param int $index Identifier for a specific print area range allowing several ranges to be set
+ * A positive index will insert after that indexed entry in the print areas list, while a
+ * negative index will insert before the indexed entry.
+ * Specifying an index value of 0, will always append the new print range at the end of the
+ * list.
+ * Print areas are numbered from 1
+ * @return PHPExcel_Worksheet_PageSetup
+ * @throws PHPExcel_Exception
+ */
public function addPrintAreaByColumnAndRow($column1, $row1, $column2, $row2, $index = -1)
{
- return $this->setPrintArea(PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2, $index, self::SETPRINTRANGE_INSERT);
- }
+ return $this->setPrintArea(PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2, $index, self::SETPRINTRANGE_INSERT);
+ }
- /**
- * Get first page number
- *
- * @return int
- */
+ /**
+ * Get first page number
+ *
+ * @return int
+ */
public function getFirstPageNumber() {
- return $this->_firstPageNumber;
+ return $this->_firstPageNumber;
}
/**
@@ -769,8 +769,8 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setFirstPageNumber($value = null) {
- $this->_firstPageNumber = $value;
- return $this;
+ $this->_firstPageNumber = $value;
+ return $this;
}
/**
@@ -779,20 +779,20 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function resetFirstPageNumber() {
- return $this->setFirstPageNumber(null);
+ return $this->setFirstPageNumber(null);
}
- /**
- * Implement PHP __clone to create a deep clone, not just a shallow copy.
- */
- public function __clone() {
- $vars = get_object_vars($this);
- foreach ($vars as $key => $value) {
- if (is_object($value)) {
- $this->$key = clone $value;
- } else {
- $this->$key = $value;
- }
- }
- }
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone() {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
}
diff --git a/Classes/PHPExcel/Worksheet/Protection.php b/Classes/PHPExcel/Worksheet/Protection.php
index 1290a914..af341988 100644
--- a/Classes/PHPExcel/Worksheet/Protection.php
+++ b/Classes/PHPExcel/Worksheet/Protection.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
@@ -35,124 +35,124 @@
*/
class PHPExcel_Worksheet_Protection
{
- /**
- * Sheet
- *
- * @var boolean
- */
- private $_sheet = false;
+ /**
+ * Sheet
+ *
+ * @var boolean
+ */
+ private $_sheet = false;
- /**
- * Objects
- *
- * @var boolean
- */
- private $_objects = false;
+ /**
+ * Objects
+ *
+ * @var boolean
+ */
+ private $_objects = false;
- /**
- * Scenarios
- *
- * @var boolean
- */
- private $_scenarios = false;
+ /**
+ * Scenarios
+ *
+ * @var boolean
+ */
+ private $_scenarios = false;
- /**
- * Format cells
- *
- * @var boolean
- */
- private $_formatCells = false;
+ /**
+ * Format cells
+ *
+ * @var boolean
+ */
+ private $_formatCells = false;
- /**
- * Format columns
- *
- * @var boolean
- */
- private $_formatColumns = false;
+ /**
+ * Format columns
+ *
+ * @var boolean
+ */
+ private $_formatColumns = false;
- /**
- * Format rows
- *
- * @var boolean
- */
- private $_formatRows = false;
+ /**
+ * Format rows
+ *
+ * @var boolean
+ */
+ private $_formatRows = false;
- /**
- * Insert columns
- *
- * @var boolean
- */
- private $_insertColumns = false;
+ /**
+ * Insert columns
+ *
+ * @var boolean
+ */
+ private $_insertColumns = false;
- /**
- * Insert rows
- *
- * @var boolean
- */
- private $_insertRows = false;
+ /**
+ * Insert rows
+ *
+ * @var boolean
+ */
+ private $_insertRows = false;
- /**
- * Insert hyperlinks
- *
- * @var boolean
- */
- private $_insertHyperlinks = false;
+ /**
+ * Insert hyperlinks
+ *
+ * @var boolean
+ */
+ private $_insertHyperlinks = false;
- /**
- * Delete columns
- *
- * @var boolean
- */
- private $_deleteColumns = false;
+ /**
+ * Delete columns
+ *
+ * @var boolean
+ */
+ private $_deleteColumns = false;
- /**
- * Delete rows
- *
- * @var boolean
- */
- private $_deleteRows = false;
+ /**
+ * Delete rows
+ *
+ * @var boolean
+ */
+ private $_deleteRows = false;
- /**
- * Select locked cells
- *
- * @var boolean
- */
- private $_selectLockedCells = false;
+ /**
+ * Select locked cells
+ *
+ * @var boolean
+ */
+ private $_selectLockedCells = false;
- /**
- * Sort
- *
- * @var boolean
- */
- private $_sort = false;
+ /**
+ * Sort
+ *
+ * @var boolean
+ */
+ private $_sort = false;
- /**
- * AutoFilter
- *
- * @var boolean
- */
- private $_autoFilter = false;
+ /**
+ * AutoFilter
+ *
+ * @var boolean
+ */
+ private $_autoFilter = false;
- /**
- * Pivot tables
- *
- * @var boolean
- */
- private $_pivotTables = false;
+ /**
+ * Pivot tables
+ *
+ * @var boolean
+ */
+ private $_pivotTables = false;
- /**
- * Select unlocked cells
- *
- * @var boolean
- */
- private $_selectUnlockedCells = false;
+ /**
+ * Select unlocked cells
+ *
+ * @var boolean
+ */
+ private $_selectUnlockedCells = false;
- /**
- * Password
- *
- * @var string
- */
- private $_password = '';
+ /**
+ * Password
+ *
+ * @var string
+ */
+ private $_password = '';
/**
* Create a new PHPExcel_Worksheet_Protection
@@ -167,22 +167,22 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function isProtectionEnabled() {
- return $this->_sheet ||
- $this->_objects ||
- $this->_scenarios ||
- $this->_formatCells ||
- $this->_formatColumns ||
- $this->_formatRows ||
- $this->_insertColumns ||
- $this->_insertRows ||
- $this->_insertHyperlinks ||
- $this->_deleteColumns ||
- $this->_deleteRows ||
- $this->_selectLockedCells ||
- $this->_sort ||
- $this->_autoFilter ||
- $this->_pivotTables ||
- $this->_selectUnlockedCells;
+ return $this->_sheet ||
+ $this->_objects ||
+ $this->_scenarios ||
+ $this->_formatCells ||
+ $this->_formatColumns ||
+ $this->_formatRows ||
+ $this->_insertColumns ||
+ $this->_insertRows ||
+ $this->_insertHyperlinks ||
+ $this->_deleteColumns ||
+ $this->_deleteRows ||
+ $this->_selectLockedCells ||
+ $this->_sort ||
+ $this->_autoFilter ||
+ $this->_pivotTables ||
+ $this->_selectUnlockedCells;
}
/**
@@ -191,7 +191,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getSheet() {
- return $this->_sheet;
+ return $this->_sheet;
}
/**
@@ -201,8 +201,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setSheet($pValue = false) {
- $this->_sheet = $pValue;
- return $this;
+ $this->_sheet = $pValue;
+ return $this;
}
/**
@@ -211,7 +211,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getObjects() {
- return $this->_objects;
+ return $this->_objects;
}
/**
@@ -221,8 +221,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setObjects($pValue = false) {
- $this->_objects = $pValue;
- return $this;
+ $this->_objects = $pValue;
+ return $this;
}
/**
@@ -231,7 +231,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getScenarios() {
- return $this->_scenarios;
+ return $this->_scenarios;
}
/**
@@ -241,8 +241,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setScenarios($pValue = false) {
- $this->_scenarios = $pValue;
- return $this;
+ $this->_scenarios = $pValue;
+ return $this;
}
/**
@@ -251,7 +251,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getFormatCells() {
- return $this->_formatCells;
+ return $this->_formatCells;
}
/**
@@ -261,8 +261,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setFormatCells($pValue = false) {
- $this->_formatCells = $pValue;
- return $this;
+ $this->_formatCells = $pValue;
+ return $this;
}
/**
@@ -271,7 +271,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getFormatColumns() {
- return $this->_formatColumns;
+ return $this->_formatColumns;
}
/**
@@ -281,8 +281,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setFormatColumns($pValue = false) {
- $this->_formatColumns = $pValue;
- return $this;
+ $this->_formatColumns = $pValue;
+ return $this;
}
/**
@@ -291,7 +291,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getFormatRows() {
- return $this->_formatRows;
+ return $this->_formatRows;
}
/**
@@ -301,8 +301,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setFormatRows($pValue = false) {
- $this->_formatRows = $pValue;
- return $this;
+ $this->_formatRows = $pValue;
+ return $this;
}
/**
@@ -311,7 +311,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getInsertColumns() {
- return $this->_insertColumns;
+ return $this->_insertColumns;
}
/**
@@ -321,8 +321,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setInsertColumns($pValue = false) {
- $this->_insertColumns = $pValue;
- return $this;
+ $this->_insertColumns = $pValue;
+ return $this;
}
/**
@@ -331,7 +331,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getInsertRows() {
- return $this->_insertRows;
+ return $this->_insertRows;
}
/**
@@ -341,8 +341,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setInsertRows($pValue = false) {
- $this->_insertRows = $pValue;
- return $this;
+ $this->_insertRows = $pValue;
+ return $this;
}
/**
@@ -351,7 +351,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getInsertHyperlinks() {
- return $this->_insertHyperlinks;
+ return $this->_insertHyperlinks;
}
/**
@@ -361,8 +361,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setInsertHyperlinks($pValue = false) {
- $this->_insertHyperlinks = $pValue;
- return $this;
+ $this->_insertHyperlinks = $pValue;
+ return $this;
}
/**
@@ -371,7 +371,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getDeleteColumns() {
- return $this->_deleteColumns;
+ return $this->_deleteColumns;
}
/**
@@ -381,8 +381,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setDeleteColumns($pValue = false) {
- $this->_deleteColumns = $pValue;
- return $this;
+ $this->_deleteColumns = $pValue;
+ return $this;
}
/**
@@ -391,7 +391,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getDeleteRows() {
- return $this->_deleteRows;
+ return $this->_deleteRows;
}
/**
@@ -401,8 +401,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setDeleteRows($pValue = false) {
- $this->_deleteRows = $pValue;
- return $this;
+ $this->_deleteRows = $pValue;
+ return $this;
}
/**
@@ -411,7 +411,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getSelectLockedCells() {
- return $this->_selectLockedCells;
+ return $this->_selectLockedCells;
}
/**
@@ -421,8 +421,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setSelectLockedCells($pValue = false) {
- $this->_selectLockedCells = $pValue;
- return $this;
+ $this->_selectLockedCells = $pValue;
+ return $this;
}
/**
@@ -431,7 +431,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getSort() {
- return $this->_sort;
+ return $this->_sort;
}
/**
@@ -441,8 +441,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setSort($pValue = false) {
- $this->_sort = $pValue;
- return $this;
+ $this->_sort = $pValue;
+ return $this;
}
/**
@@ -451,7 +451,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getAutoFilter() {
- return $this->_autoFilter;
+ return $this->_autoFilter;
}
/**
@@ -461,8 +461,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setAutoFilter($pValue = false) {
- $this->_autoFilter = $pValue;
- return $this;
+ $this->_autoFilter = $pValue;
+ return $this;
}
/**
@@ -471,7 +471,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getPivotTables() {
- return $this->_pivotTables;
+ return $this->_pivotTables;
}
/**
@@ -481,8 +481,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setPivotTables($pValue = false) {
- $this->_pivotTables = $pValue;
- return $this;
+ $this->_pivotTables = $pValue;
+ return $this;
}
/**
@@ -491,7 +491,7 @@ class PHPExcel_Worksheet_Protection
* @return boolean
*/
function getSelectUnlockedCells() {
- return $this->_selectUnlockedCells;
+ return $this->_selectUnlockedCells;
}
/**
@@ -501,8 +501,8 @@ class PHPExcel_Worksheet_Protection
* @return PHPExcel_Worksheet_Protection
*/
function setSelectUnlockedCells($pValue = false) {
- $this->_selectUnlockedCells = $pValue;
- return $this;
+ $this->_selectUnlockedCells = $pValue;
+ return $this;
}
/**
@@ -511,35 +511,35 @@ class PHPExcel_Worksheet_Protection
* @return string
*/
function getPassword() {
- return $this->_password;
+ return $this->_password;
}
/**
* Set Password
*
- * @param string $pValue
- * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
+ * @param string $pValue
+ * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_Worksheet_Protection
*/
function setPassword($pValue = '', $pAlreadyHashed = false) {
- if (!$pAlreadyHashed) {
- $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
- }
- $this->_password = $pValue;
- return $this;
+ if (!$pAlreadyHashed) {
+ $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
+ }
+ $this->_password = $pValue;
+ return $this;
}
- /**
- * Implement PHP __clone to create a deep clone, not just a shallow copy.
- */
- public function __clone() {
- $vars = get_object_vars($this);
- foreach ($vars as $key => $value) {
- if (is_object($value)) {
- $this->$key = clone $value;
- } else {
- $this->$key = $value;
- }
- }
- }
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone() {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
}
diff --git a/Classes/PHPExcel/Worksheet/SheetView.php b/Classes/PHPExcel/Worksheet/SheetView.php
index 2396ddaa..f2448e2b 100644
--- a/Classes/PHPExcel/Worksheet/SheetView.php
+++ b/Classes/PHPExcel/Worksheet/SheetView.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
@@ -36,43 +36,43 @@
class PHPExcel_Worksheet_SheetView
{
- /* Sheet View types */
- const SHEETVIEW_NORMAL = 'normal';
- const SHEETVIEW_PAGE_LAYOUT = 'pageLayout';
- const SHEETVIEW_PAGE_BREAK_PREVIEW = 'pageBreakPreview';
+ /* Sheet View types */
+ const SHEETVIEW_NORMAL = 'normal';
+ const SHEETVIEW_PAGE_LAYOUT = 'pageLayout';
+ const SHEETVIEW_PAGE_BREAK_PREVIEW = 'pageBreakPreview';
- private static $_sheetViewTypes = array(
- self::SHEETVIEW_NORMAL,
- self::SHEETVIEW_PAGE_LAYOUT,
- self::SHEETVIEW_PAGE_BREAK_PREVIEW,
- );
+ private static $_sheetViewTypes = array(
+ self::SHEETVIEW_NORMAL,
+ self::SHEETVIEW_PAGE_LAYOUT,
+ self::SHEETVIEW_PAGE_BREAK_PREVIEW,
+ );
- /**
- * ZoomScale
- *
- * Valid values range from 10 to 400.
- *
- * @var int
- */
- private $_zoomScale = 100;
+ /**
+ * ZoomScale
+ *
+ * Valid values range from 10 to 400.
+ *
+ * @var int
+ */
+ private $_zoomScale = 100;
- /**
- * ZoomScaleNormal
- *
- * Valid values range from 10 to 400.
- *
- * @var int
- */
- private $_zoomScaleNormal = 100;
+ /**
+ * ZoomScaleNormal
+ *
+ * Valid values range from 10 to 400.
+ *
+ * @var int
+ */
+ private $_zoomScaleNormal = 100;
- /**
- * View
- *
- * Valid values range from 10 to 400.
- *
- * @var string
- */
- private $_sheetviewType = self::SHEETVIEW_NORMAL;
+ /**
+ * View
+ *
+ * Valid values range from 10 to 400.
+ *
+ * @var string
+ */
+ private $_sheetviewType = self::SHEETVIEW_NORMAL;
/**
* Create a new PHPExcel_Worksheet_SheetView
@@ -81,108 +81,108 @@ class PHPExcel_Worksheet_SheetView
{
}
- /**
- * Get ZoomScale
- *
- * @return int
- */
- public function getZoomScale() {
- return $this->_zoomScale;
- }
+ /**
+ * Get ZoomScale
+ *
+ * @return int
+ */
+ public function getZoomScale() {
+ return $this->_zoomScale;
+ }
- /**
- * Set ZoomScale
- *
- * Valid values range from 10 to 400.
- *
- * @param int $pValue
- * @throws PHPExcel_Exception
- * @return PHPExcel_Worksheet_SheetView
- */
- public function setZoomScale($pValue = 100) {
- // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
- // but it is apparently still able to handle any scale >= 1
- if (($pValue >= 1) || is_null($pValue)) {
- $this->_zoomScale = $pValue;
- } else {
- throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
- }
- return $this;
- }
+ /**
+ * Set ZoomScale
+ *
+ * Valid values range from 10 to 400.
+ *
+ * @param int $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_SheetView
+ */
+ public function setZoomScale($pValue = 100) {
+ // Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
+ // but it is apparently still able to handle any scale >= 1
+ if (($pValue >= 1) || is_null($pValue)) {
+ $this->_zoomScale = $pValue;
+ } else {
+ throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
+ }
+ return $this;
+ }
- /**
- * Get ZoomScaleNormal
- *
- * @return int
- */
- public function getZoomScaleNormal() {
- return $this->_zoomScaleNormal;
- }
+ /**
+ * Get ZoomScaleNormal
+ *
+ * @return int
+ */
+ public function getZoomScaleNormal() {
+ return $this->_zoomScaleNormal;
+ }
- /**
- * Set ZoomScale
- *
- * Valid values range from 10 to 400.
- *
- * @param int $pValue
- * @throws PHPExcel_Exception
- * @return PHPExcel_Worksheet_SheetView
- */
- public function setZoomScaleNormal($pValue = 100) {
- if (($pValue >= 1) || is_null($pValue)) {
- $this->_zoomScaleNormal = $pValue;
- } else {
- throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
- }
- return $this;
- }
+ /**
+ * Set ZoomScale
+ *
+ * Valid values range from 10 to 400.
+ *
+ * @param int $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_SheetView
+ */
+ public function setZoomScaleNormal($pValue = 100) {
+ if (($pValue >= 1) || is_null($pValue)) {
+ $this->_zoomScaleNormal = $pValue;
+ } else {
+ throw new PHPExcel_Exception("Scale must be greater than or equal to 1.");
+ }
+ return $this;
+ }
- /**
- * Get View
- *
- * @return string
- */
- public function getView() {
- return $this->_sheetviewType;
- }
+ /**
+ * Get View
+ *
+ * @return string
+ */
+ public function getView() {
+ return $this->_sheetviewType;
+ }
- /**
- * Set View
- *
- * Valid values are
- * 'normal' self::SHEETVIEW_NORMAL
- * 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT
- * 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW
- *
- * @param string $pValue
- * @throws PHPExcel_Exception
- * @return PHPExcel_Worksheet_SheetView
- */
- public function setView($pValue = NULL) {
- // MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview'
- // via the user interface
- if ($pValue === NULL)
- $pValue = self::SHEETVIEW_NORMAL;
- if (in_array($pValue, self::$_sheetViewTypes)) {
- $this->_sheetviewType = $pValue;
- } else {
- throw new PHPExcel_Exception("Invalid sheetview layout type.");
- }
+ /**
+ * Set View
+ *
+ * Valid values are
+ * 'normal' self::SHEETVIEW_NORMAL
+ * 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT
+ * 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW
+ *
+ * @param string $pValue
+ * @throws PHPExcel_Exception
+ * @return PHPExcel_Worksheet_SheetView
+ */
+ public function setView($pValue = NULL) {
+ // MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview'
+ // via the user interface
+ if ($pValue === NULL)
+ $pValue = self::SHEETVIEW_NORMAL;
+ if (in_array($pValue, self::$_sheetViewTypes)) {
+ $this->_sheetviewType = $pValue;
+ } else {
+ throw new PHPExcel_Exception("Invalid sheetview layout type.");
+ }
- return $this;
- }
+ return $this;
+ }
- /**
- * Implement PHP __clone to create a deep clone, not just a shallow copy.
- */
- public function __clone() {
- $vars = get_object_vars($this);
- foreach ($vars as $key => $value) {
- if (is_object($value)) {
- $this->$key = clone $value;
- } else {
- $this->$key = $value;
- }
- }
- }
+ /**
+ * Implement PHP __clone to create a deep clone, not just a shallow copy.
+ */
+ public function __clone() {
+ $vars = get_object_vars($this);
+ foreach ($vars as $key => $value) {
+ if (is_object($value)) {
+ $this->$key = clone $value;
+ } else {
+ $this->$key = $value;
+ }
+ }
+ }
}
diff --git a/Classes/PHPExcel/Writer/Excel2007/WriterPart.php b/Classes/PHPExcel/Writer/Excel2007/WriterPart.php
index 1ade577e..b32f1ad4 100644
--- a/Classes/PHPExcel/Writer/Excel2007/WriterPart.php
+++ b/Classes/PHPExcel/Writer/Excel2007/WriterPart.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
@@ -48,7 +48,8 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
* @param PHPExcel_Writer_IWriter $pWriter
* @throws PHPExcel_Writer_Exception
*/
- public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null) {
+ public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null)
+ {
$this->_parentWriter = $pWriter;
}
@@ -58,7 +59,8 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
* @return PHPExcel_Writer_IWriter
* @throws PHPExcel_Writer_Exception
*/
- public function getParentWriter() {
+ public function getParentWriter()
+ {
if (!is_null($this->_parentWriter)) {
return $this->_parentWriter;
} else {
@@ -72,10 +74,10 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
* @param PHPExcel_Writer_IWriter $pWriter
* @throws PHPExcel_Writer_Exception
*/
- public function __construct(PHPExcel_Writer_IWriter $pWriter = null) {
+ public function __construct(PHPExcel_Writer_IWriter $pWriter = null)
+ {
if (!is_null($pWriter)) {
$this->_parentWriter = $pWriter;
}
}
-
}
diff --git a/Classes/PHPExcel/Writer/Excel5.php b/Classes/PHPExcel/Writer/Excel5.php
index 63a4ca72..d2502aa0 100644
--- a/Classes/PHPExcel/Writer/Excel5.php
+++ b/Classes/PHPExcel/Writer/Excel5.php
@@ -95,7 +95,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
*
* @param PHPExcel $phpExcel PHPExcel object
*/
- public function __construct(PHPExcel $phpExcel) {
+ public function __construct(PHPExcel $phpExcel)
+ {
$this->_phpExcel = $phpExcel;
$this->_parser = new PHPExcel_Writer_Excel5_Parser();
@@ -107,13 +108,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* @param string $pFilename
* @throws PHPExcel_Writer_Exception
*/
- public function save($pFilename = null) {
+ public function save($pFilename = null)
+ {
// garbage collect
$this->_phpExcel->garbageCollect();
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
- PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE);
+ PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false);
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
@@ -121,18 +123,12 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$this->_colors = array();
// Initialise workbook writer
- $this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel,
- $this->_str_total, $this->_str_unique, $this->_str_table,
- $this->_colors, $this->_parser);
+ $this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser);
// Initialise worksheet writers
$countSheets = $this->_phpExcel->getSheetCount();
for ($i = 0; $i < $countSheets; ++$i) {
- $this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique,
- $this->_str_table, $this->_colors,
- $this->_parser,
- $this->_preCalculateFormulas,
- $this->_phpExcel->getSheet($i));
+ $this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser, $this->_preCalculateFormulas, $this->_phpExcel->getSheet($i));
}
// build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.
@@ -190,26 +186,26 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation();
// initialize OLE Document Summary Information
- if(isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)){
+ if (isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)) {
$OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation'));
$OLE_DocumentSummaryInformation->append($this->_documentSummaryInformation);
}
$this->_summaryInformation = $this->_writeSummaryInformation();
// initialize OLE Summary Information
- if(isset($this->_summaryInformation) && !empty($this->_summaryInformation)){
- $OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
- $OLE_SummaryInformation->append($this->_summaryInformation);
+ if (isset($this->_summaryInformation) && !empty($this->_summaryInformation)) {
+ $OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
+ $OLE_SummaryInformation->append($this->_summaryInformation);
}
// define OLE Parts
$arrRootData = array($OLE);
// initialize OLE Properties file
- if(isset($OLE_SummaryInformation)){
+ if (isset($OLE_SummaryInformation)) {
$arrRootData[] = $OLE_SummaryInformation;
}
// initialize OLE Extended Properties file
- if(isset($OLE_DocumentSummaryInformation)){
+ if (isset($OLE_DocumentSummaryInformation)) {
$arrRootData[] = $OLE_DocumentSummaryInformation;
}
@@ -229,7 +225,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* @throws PHPExcel_Writer_Exception when directory does not exist
* @return PHPExcel_Writer_Excel5
*/
- public function setTempDir($pValue = '') {
+ public function setTempDir($pValue = '')
+ {
return $this;
}
@@ -330,13 +327,13 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
}
// AutoFilters
- if(!empty($filterRange)){
+ if (!empty($filterRange)) {
$rangeBounds = PHPExcel_Cell::rangeBoundaries($filterRange);
$iNumColStart = $rangeBounds[0][0];
$iNumColEnd = $rangeBounds[1][0];
$iInc = $iNumColStart;
- while($iInc <= $iNumColEnd){
+ while($iInc <= $iNumColEnd) {
++$countShapes[$sheetIndex];
// create an Drawing Object for the dropdown
@@ -444,8 +441,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
++$sheetCountShapes;
++$totalCountShapes;
- $spId = $sheetCountShapes
- | ($this->_phpExcel->getIndex($sheet) + 1) << 10;
+ $spId = $sheetCountShapes | ($this->_phpExcel->getIndex($sheet) + 1) << 10;
$spIdMax = max($spId, $spIdMax);
}
}
@@ -463,41 +459,35 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
foreach ($this->_phpExcel->getAllsheets() as $sheet) {
foreach ($sheet->getDrawingCollection() as $drawing) {
if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
-
$filename = $drawing->getPath();
list($imagesx, $imagesy, $imageFormat) = getimagesize($filename);
switch ($imageFormat) {
-
- case 1: // GIF, not supported by BIFF8, we convert to PNG
- $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
- ob_start();
- imagepng(imagecreatefromgif($filename));
- $blipData = ob_get_contents();
- ob_end_clean();
- break;
-
- case 2: // JPEG
- $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
- $blipData = file_get_contents($filename);
- break;
-
- case 3: // PNG
- $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
- $blipData = file_get_contents($filename);
- break;
-
- case 6: // Windows DIB (BMP), we convert to PNG
- $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
- ob_start();
- imagepng(PHPExcel_Shared_Drawing::imagecreatefrombmp($filename));
- $blipData = ob_get_contents();
- ob_end_clean();
- break;
-
- default: continue 2;
-
+ case 1: // GIF, not supported by BIFF8, we convert to PNG
+ $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
+ ob_start();
+ imagepng(imagecreatefromgif ($filename));
+ $blipData = ob_get_contents();
+ ob_end_clean();
+ break;
+ case 2: // JPEG
+ $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
+ $blipData = file_get_contents($filename);
+ break;
+ case 3: // PNG
+ $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
+ $blipData = file_get_contents($filename);
+ break;
+ case 6: // Windows DIB (BMP), we convert to PNG
+ $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
+ ob_start();
+ imagepng(PHPExcel_Shared_Drawing::imagecreatefrombmp($filename));
+ $blipData = ob_get_contents();
+ ob_end_clean();
+ break;
+ default:
+ continue 2;
}
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
@@ -508,23 +498,18 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$BSE->setBlip($blip);
$bstoreContainer->addBSE($BSE);
-
} else if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
-
switch ($drawing->getRenderingFunction()) {
-
- case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG:
- $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
- $renderingFunction = 'imagejpeg';
- break;
-
- case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF:
- case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG:
- case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT:
- $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
- $renderingFunction = 'imagepng';
- break;
-
+ case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG:
+ $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
+ $renderingFunction = 'imagejpeg';
+ break;
+ case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF:
+ case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG:
+ case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT:
+ $blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
+ $renderingFunction = 'imagepng';
+ break;
}
ob_start();
@@ -552,8 +537,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* Build the OLE Part for DocumentSummary Information
* @return string
*/
- private function _writeDocumentSummaryInformation(){
-
+ private function _writeDocumentSummaryInformation()
+ {
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
$data = pack('v', 0xFFFE);
// offset: 2; size: 2;
@@ -586,7 +571,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
// GKPIDDSI_CATEGORY : Category
- if($this->_phpExcel->getProperties()->getCategory()){
+ if ($this->_phpExcel->getProperties()->getCategory()) {
$dataProp = $this->_phpExcel->getProperties()->getCategory();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
'offset' => array('pack' => 'V'),
@@ -682,7 +667,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
// 4 Property count
// 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
$dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
- foreach ($dataSection as $dataProp){
+ foreach ($dataSection as $dataProp) {
// Summary
$dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
// Offset
@@ -690,25 +675,25 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
// DataType
$dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
// Data
- if($dataProp['type']['data'] == 0x02){ // 2 byte signed integer
+ if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
- elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer
+ elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
- elseif($dataProp['type']['data'] == 0x0B){ // Boolean
- if($dataProp['data']['data'] == false){
+ elseif ($dataProp['type']['data'] == 0x0B) { // Boolean
+ if ($dataProp['data']['data'] == false) {
$dataSection_Content .= pack('V', 0x0000);
} else {
$dataSection_Content .= pack('V', 0x0001);
}
$dataSection_Content_Offset += 4 + 4;
}
- elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length
+ elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
// Null-terminated string
$dataProp['data']['data'] .= chr(0);
$dataProp['data']['length'] += 1;
@@ -721,7 +706,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
}
- elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
+ elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 8;
@@ -753,7 +738,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
* Build the OLE Part for Summary Information
* @return string
*/
- private function _writeSummaryInformation(){
+ private function _writeSummaryInformation()
+ {
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
$data = pack('v', 0xFFFE);
// offset: 2; size: 2;
@@ -786,7 +772,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
// Title
- if($this->_phpExcel->getProperties()->getTitle()){
+ if ($this->_phpExcel->getProperties()->getTitle()) {
$dataProp = $this->_phpExcel->getProperties()->getTitle();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
'offset' => array('pack' => 'V'),
@@ -795,7 +781,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Subject
- if($this->_phpExcel->getProperties()->getSubject()){
+ if ($this->_phpExcel->getProperties()->getSubject()) {
$dataProp = $this->_phpExcel->getProperties()->getSubject();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03),
'offset' => array('pack' => 'V'),
@@ -804,7 +790,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Author (Creator)
- if($this->_phpExcel->getProperties()->getCreator()){
+ if ($this->_phpExcel->getProperties()->getCreator()) {
$dataProp = $this->_phpExcel->getProperties()->getCreator();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04),
'offset' => array('pack' => 'V'),
@@ -813,7 +799,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Keywords
- if($this->_phpExcel->getProperties()->getKeywords()){
+ if ($this->_phpExcel->getProperties()->getKeywords()) {
$dataProp = $this->_phpExcel->getProperties()->getKeywords();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05),
'offset' => array('pack' => 'V'),
@@ -822,7 +808,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Comments (Description)
- if($this->_phpExcel->getProperties()->getDescription()){
+ if ($this->_phpExcel->getProperties()->getDescription()) {
$dataProp = $this->_phpExcel->getProperties()->getDescription();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06),
'offset' => array('pack' => 'V'),
@@ -831,7 +817,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Last Saved By (LastModifiedBy)
- if($this->_phpExcel->getProperties()->getLastModifiedBy()){
+ if ($this->_phpExcel->getProperties()->getLastModifiedBy()) {
$dataProp = $this->_phpExcel->getProperties()->getLastModifiedBy();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08),
'offset' => array('pack' => 'V'),
@@ -840,7 +826,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Created Date/Time
- if($this->_phpExcel->getProperties()->getCreated()){
+ if ($this->_phpExcel->getProperties()->getCreated()) {
$dataProp = $this->_phpExcel->getProperties()->getCreated();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C),
'offset' => array('pack' => 'V'),
@@ -849,7 +835,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_NumProps++;
}
// Modified Date/Time
- if($this->_phpExcel->getProperties()->getModified()){
+ if ($this->_phpExcel->getProperties()->getModified()) {
$dataProp = $this->_phpExcel->getProperties()->getModified();
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D),
'offset' => array('pack' => 'V'),
@@ -869,7 +855,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
// 4 Property count
// 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
$dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
- foreach ($dataSection as $dataProp){
+ foreach ($dataSection as $dataProp) {
// Summary
$dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
// Offset
@@ -877,17 +863,17 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
// DataType
$dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
// Data
- if($dataProp['type']['data'] == 0x02){ // 2 byte signed integer
+ if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
- elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer
+ elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
- elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length
+ elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
// Null-terminated string
$dataProp['data']['data'] .= chr(0);
$dataProp['data']['length'] += 1;
@@ -900,7 +886,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
}
- elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
+ elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 8;
diff --git a/Classes/PHPExcel/Writer/Excel5/BIFFwriter.php b/Classes/PHPExcel/Writer/Excel5/BIFFwriter.php
index de062488..05ae77ff 100644
--- a/Classes/PHPExcel/Writer/Excel5/BIFFwriter.php
+++ b/Classes/PHPExcel/Writer/Excel5/BIFFwriter.php
@@ -118,7 +118,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
$number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
if ($number == $teststr) {
$byte_order = 0; // Little Endian
- } elseif ($number == strrev($teststr)){
+ } elseif ($number == strrev($teststr)) {
$byte_order = 1; // Big Endian
} else {
// Give up. I'll fix this in a later version.
@@ -136,7 +136,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* @param string $data binary data to append
* @access private
*/
- function _append($data)
+ private function _append($data)
{
if (strlen($data) - 4 > $this->_limit) {
$data = $this->_addContinue($data);
@@ -169,7 +169,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* 0x0010 Worksheet.
* @access private
*/
- function _storeBof($type)
+ private function _storeBof($type)
{
$record = 0x0809; // Record identifier (BIFF5-BIFF8)
$length = 0x0010;
@@ -182,7 +182,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
$version = 0x0600; // BIFF8
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("vvvv", $version, $type, $build, $year);
$this->_append($header . $data . $unknown);
}
@@ -192,7 +192,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
*
* @access private
*/
- function _storeEof()
+ private function _storeEof()
{
$record = 0x000A; // Record identifier
$length = 0x0000; // Number of bytes to follow
@@ -226,7 +226,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
* @return string A very convenient string of continue blocks
* @access private
*/
- function _addContinue($data)
+ private function _addContinue($data)
{
$limit = $this->_limit;
$record = 0x003C; // Record identifier
@@ -251,5 +251,4 @@ class PHPExcel_Writer_Excel5_BIFFwriter
return $tmp;
}
-
}
diff --git a/Classes/PHPExcel/Writer/Excel5/Escher.php b/Classes/PHPExcel/Writer/Excel5/Escher.php
index 9b8ae871..62e62f22 100644
--- a/Classes/PHPExcel/Writer/Excel5/Escher.php
+++ b/Classes/PHPExcel/Writer/Excel5/Escher.php
@@ -78,436 +78,423 @@ class PHPExcel_Writer_Excel5_Escher
$this->_data = '';
switch (get_class($this->_object)) {
+ case 'PHPExcel_Shared_Escher':
+ if ($dggContainer = $this->_object->getDggContainer()) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($dggContainer);
+ $this->_data = $writer->close();
+ } else if ($dgContainer = $this->_object->getDgContainer()) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($dgContainer);
+ $this->_data = $writer->close();
+ $this->_spOffsets = $writer->getSpOffsets();
+ $this->_spTypes = $writer->getSpTypes();
+ }
+ break;
+ case 'PHPExcel_Shared_Escher_DggContainer':
+ // this is a container record
- case 'PHPExcel_Shared_Escher':
- if ($dggContainer = $this->_object->getDggContainer()) {
- $writer = new PHPExcel_Writer_Excel5_Escher($dggContainer);
- $this->_data = $writer->close();
- } else if ($dgContainer = $this->_object->getDgContainer()) {
- $writer = new PHPExcel_Writer_Excel5_Escher($dgContainer);
- $this->_data = $writer->close();
- $this->_spOffsets = $writer->getSpOffsets();
- $this->_spTypes = $writer->getSpTypes();
- }
- break;
+ // initialize
+ $innerData = '';
- case 'PHPExcel_Shared_Escher_DggContainer':
- // this is a container record
+ // write the dgg
+ $recVer = 0x0;
+ $recInstance = 0x0000;
+ $recType = 0xF006;
- // initialize
- $innerData = '';
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
- // write the dgg
- $recVer = 0x0;
- $recInstance = 0x0000;
- $recType = 0xF006;
+ // dgg data
+ $dggData =
+ pack('VVVV',
+ $this->_object->getSpIdMax(), // maximum shape identifier increased by one
+ $this->_object->getCDgSaved() + 1, // number of file identifier clusters increased by one
+ $this->_object->getCSpSaved(),
+ $this->_object->getCDgSaved() // count total number of drawings saved
+ );
- $recVerInstance = $recVer;
- $recVerInstance |= $recInstance << 4;
+ // add file identifier clusters (one per drawing)
+ $IDCLs = $this->_object->getIDCLs();
- // dgg data
- $dggData =
- pack('VVVV'
- , $this->_object->getSpIdMax() // maximum shape identifier increased by one
- , $this->_object->getCDgSaved() + 1 // number of file identifier clusters increased by one
- , $this->_object->getCSpSaved()
- , $this->_object->getCDgSaved() // count total number of drawings saved
- );
+ foreach ($IDCLs as $dgId => $maxReducedSpId) {
+ $dggData .= pack('VV', $dgId, $maxReducedSpId + 1);
+ }
- // add file identifier clusters (one per drawing)
- $IDCLs = $this->_object->getIDCLs();
+ $header = pack('vvV', $recVerInstance, $recType, strlen($dggData));
+ $innerData .= $header . $dggData;
- foreach ($IDCLs as $dgId => $maxReducedSpId) {
- $dggData .= pack('VV', $dgId, $maxReducedSpId + 1);
- }
-
- $header = pack('vvV', $recVerInstance, $recType, strlen($dggData));
- $innerData .= $header . $dggData;
-
- // write the bstoreContainer
- if ($bstoreContainer = $this->_object->getBstoreContainer()) {
- $writer = new PHPExcel_Writer_Excel5_Escher($bstoreContainer);
- $innerData .= $writer->close();
- }
-
- // write the record
- $recVer = 0xF;
- $recInstance = 0x0000;
- $recType = 0xF000;
- $length = strlen($innerData);
-
- $recVerInstance = $recVer;
- $recVerInstance |= $recInstance << 4;
-
- $header = pack('vvV', $recVerInstance, $recType, $length);
-
- $this->_data = $header . $innerData;
- break;
-
- case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer':
- // this is a container record
-
- // initialize
- $innerData = '';
-
- // treat the inner data
- if ($BSECollection = $this->_object->getBSECollection()) {
- foreach ($BSECollection as $BSE) {
- $writer = new PHPExcel_Writer_Excel5_Escher($BSE);
+ // write the bstoreContainer
+ if ($bstoreContainer = $this->_object->getBstoreContainer()) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($bstoreContainer);
$innerData .= $writer->close();
}
- }
- // write the record
- $recVer = 0xF;
- $recInstance = count($this->_object->getBSECollection());
- $recType = 0xF001;
- $length = strlen($innerData);
-
- $recVerInstance = $recVer;
- $recVerInstance |= $recInstance << 4;
-
- $header = pack('vvV', $recVerInstance, $recType, $length);
-
- $this->_data = $header . $innerData;
- break;
-
- case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE':
- // this is a semi-container record
-
- // initialize
- $innerData = '';
-
- // here we treat the inner data
- if ($blip = $this->_object->getBlip()) {
- $writer = new PHPExcel_Writer_Excel5_Escher($blip);
- $innerData .= $writer->close();
- }
-
- // initialize
- $data = '';
-
- $btWin32 = $this->_object->getBlipType();
- $btMacOS = $this->_object->getBlipType();
- $data .= pack('CC', $btWin32, $btMacOS);
-
- $rgbUid = pack('VVVV', 0,0,0,0); // todo
- $data .= $rgbUid;
-
- $tag = 0;
- $size = strlen($innerData);
- $cRef = 1;
- $foDelay = 0; //todo
- $unused1 = 0x0;
- $cbName = 0x0;
- $unused2 = 0x0;
- $unused3 = 0x0;
- $data .= pack('vVVVCCCC', $tag, $size, $cRef, $foDelay, $unused1, $cbName, $unused2, $unused3);
-
- $data .= $innerData;
-
- // write the record
- $recVer = 0x2;
- $recInstance = $this->_object->getBlipType();
- $recType = 0xF007;
- $length = strlen($data);
-
- $recVerInstance = $recVer;
- $recVerInstance |= $recInstance << 4;
-
- $header = pack('vvV', $recVerInstance, $recType, $length);
-
- $this->_data = $header;
-
- $this->_data .= $data;
- break;
-
- case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip':
- // this is an atom record
-
- // write the record
- switch ($this->_object->getParent()->getBlipType()) {
-
- case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG:
- // initialize
- $innerData = '';
-
- $rgbUid1 = pack('VVVV', 0,0,0,0); // todo
- $innerData .= $rgbUid1;
-
- $tag = 0xFF; // todo
- $innerData .= pack('C', $tag);
-
- $innerData .= $this->_object->getData();
-
- $recVer = 0x0;
- $recInstance = 0x46A;
- $recType = 0xF01D;
+ // write the record
+ $recVer = 0xF;
+ $recInstance = 0x0000;
+ $recType = 0xF000;
$length = strlen($innerData);
$recVerInstance = $recVer;
- $recVerInstance |= $recInstance << 4;
+ $recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
- $this->_data = $header;
-
- $this->_data .= $innerData;
+ $this->_data = $header . $innerData;
break;
+ case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer':
+ // this is a container record
- case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG:
// initialize
$innerData = '';
- $rgbUid1 = pack('VVVV', 0,0,0,0); // todo
- $innerData .= $rgbUid1;
-
- $tag = 0xFF; // todo
- $innerData .= pack('C', $tag);
-
- $innerData .= $this->_object->getData();
-
- $recVer = 0x0;
- $recInstance = 0x6E0;
- $recType = 0xF01E;
- $length = strlen($innerData);
-
- $recVerInstance = $recVer;
- $recVerInstance |= $recInstance << 4;
-
- $header = pack('vvV', $recVerInstance, $recType, $length);
-
- $this->_data = $header;
-
- $this->_data .= $innerData;
- break;
-
- }
- break;
-
- case 'PHPExcel_Shared_Escher_DgContainer':
- // this is a container record
-
- // initialize
- $innerData = '';
-
- // write the dg
- $recVer = 0x0;
- $recInstance = $this->_object->getDgId();
- $recType = 0xF008;
- $length = 8;
-
- $recVerInstance = $recVer;
- $recVerInstance |= $recInstance << 4;
-
- $header = pack('vvV', $recVerInstance, $recType, $length);
-
- // number of shapes in this drawing (including group shape)
- $countShapes = count($this->_object->getSpgrContainer()->getChildren());
- $innerData .= $header . pack('VV', $countShapes, $this->_object->getLastSpId());
- //$innerData .= $header . pack('VV', 0, 0);
-
- // write the spgrContainer
- if ($spgrContainer = $this->_object->getSpgrContainer()) {
- $writer = new PHPExcel_Writer_Excel5_Escher($spgrContainer);
- $innerData .= $writer->close();
-
- // get the shape offsets relative to the spgrContainer record
- $spOffsets = $writer->getSpOffsets();
- $spTypes = $writer->getSpTypes();
-
- // save the shape offsets relative to dgContainer
- foreach ($spOffsets as & $spOffset) {
- $spOffset += 24; // add length of dgContainer header data (8 bytes) plus dg data (16 bytes)
+ // treat the inner data
+ if ($BSECollection = $this->_object->getBSECollection()) {
+ foreach ($BSECollection as $BSE) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($BSE);
+ $innerData .= $writer->close();
+ }
}
+ // write the record
+ $recVer = 0xF;
+ $recInstance = count($this->_object->getBSECollection());
+ $recType = 0xF001;
+ $length = strlen($innerData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->_data = $header . $innerData;
+ break;
+ case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE':
+ // this is a semi-container record
+
+ // initialize
+ $innerData = '';
+
+ // here we treat the inner data
+ if ($blip = $this->_object->getBlip()) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($blip);
+ $innerData .= $writer->close();
+ }
+
+ // initialize
+ $data = '';
+
+ $btWin32 = $this->_object->getBlipType();
+ $btMacOS = $this->_object->getBlipType();
+ $data .= pack('CC', $btWin32, $btMacOS);
+
+ $rgbUid = pack('VVVV', 0,0,0,0); // todo
+ $data .= $rgbUid;
+
+ $tag = 0;
+ $size = strlen($innerData);
+ $cRef = 1;
+ $foDelay = 0; //todo
+ $unused1 = 0x0;
+ $cbName = 0x0;
+ $unused2 = 0x0;
+ $unused3 = 0x0;
+ $data .= pack('vVVVCCCC', $tag, $size, $cRef, $foDelay, $unused1, $cbName, $unused2, $unused3);
+
+ $data .= $innerData;
+
+ // write the record
+ $recVer = 0x2;
+ $recInstance = $this->_object->getBlipType();
+ $recType = 0xF007;
+ $length = strlen($data);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->_data = $header;
+
+ $this->_data .= $data;
+ break;
+ case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip':
+ // this is an atom record
+
+ // write the record
+ switch ($this->_object->getParent()->getBlipType()) {
+ case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG:
+ // initialize
+ $innerData = '';
+
+ $rgbUid1 = pack('VVVV', 0,0,0,0); // todo
+ $innerData .= $rgbUid1;
+
+ $tag = 0xFF; // todo
+ $innerData .= pack('C', $tag);
+
+ $innerData .= $this->_object->getData();
+
+ $recVer = 0x0;
+ $recInstance = 0x46A;
+ $recType = 0xF01D;
+ $length = strlen($innerData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->_data = $header;
+
+ $this->_data .= $innerData;
+ break;
+
+ case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG:
+ // initialize
+ $innerData = '';
+
+ $rgbUid1 = pack('VVVV', 0,0,0,0); // todo
+ $innerData .= $rgbUid1;
+
+ $tag = 0xFF; // todo
+ $innerData .= pack('C', $tag);
+
+ $innerData .= $this->_object->getData();
+
+ $recVer = 0x0;
+ $recInstance = 0x6E0;
+ $recType = 0xF01E;
+ $length = strlen($innerData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->_data = $header;
+
+ $this->_data .= $innerData;
+ break;
+ }
+ break;
+ case 'PHPExcel_Shared_Escher_DgContainer':
+ // this is a container record
+
+ // initialize
+ $innerData = '';
+
+ // write the dg
+ $recVer = 0x0;
+ $recInstance = $this->_object->getDgId();
+ $recType = 0xF008;
+ $length = 8;
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ // number of shapes in this drawing (including group shape)
+ $countShapes = count($this->_object->getSpgrContainer()->getChildren());
+ $innerData .= $header . pack('VV', $countShapes, $this->_object->getLastSpId());
+ //$innerData .= $header . pack('VV', 0, 0);
+
+ // write the spgrContainer
+ if ($spgrContainer = $this->_object->getSpgrContainer()) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($spgrContainer);
+ $innerData .= $writer->close();
+
+ // get the shape offsets relative to the spgrContainer record
+ $spOffsets = $writer->getSpOffsets();
+ $spTypes = $writer->getSpTypes();
+
+ // save the shape offsets relative to dgContainer
+ foreach ($spOffsets as & $spOffset) {
+ $spOffset += 24; // add length of dgContainer header data (8 bytes) plus dg data (16 bytes)
+ }
+
+ $this->_spOffsets = $spOffsets;
+ $this->_spTypes = $spTypes;
+ }
+
+ // write the record
+ $recVer = 0xF;
+ $recInstance = 0x0000;
+ $recType = 0xF002;
+ $length = strlen($innerData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->_data = $header . $innerData;
+ break;
+ case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer':
+ // this is a container record
+
+ // initialize
+ $innerData = '';
+
+ // initialize spape offsets
+ $totalSize = 8;
+ $spOffsets = array();
+ $spTypes = array();
+
+ // treat the inner data
+ foreach ($this->_object->getChildren() as $spContainer) {
+ $writer = new PHPExcel_Writer_Excel5_Escher($spContainer);
+ $spData = $writer->close();
+ $innerData .= $spData;
+
+ // save the shape offsets (where new shape records begin)
+ $totalSize += strlen($spData);
+ $spOffsets[] = $totalSize;
+
+ $spTypes = array_merge($spTypes, $writer->getSpTypes());
+ }
+
+ // write the record
+ $recVer = 0xF;
+ $recInstance = 0x0000;
+ $recType = 0xF003;
+ $length = strlen($innerData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+
+ $this->_data = $header . $innerData;
$this->_spOffsets = $spOffsets;
$this->_spTypes = $spTypes;
- }
+ break;
+ case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer':
+ // initialize
+ $data = '';
- // write the record
- $recVer = 0xF;
- $recInstance = 0x0000;
- $recType = 0xF002;
- $length = strlen($innerData);
+ // build the data
- $recVerInstance = $recVer;
- $recVerInstance |= $recInstance << 4;
+ // write group shape record, if necessary?
+ if ($this->_object->getSpgr()) {
+ $recVer = 0x1;
+ $recInstance = 0x0000;
+ $recType = 0xF009;
+ $length = 0x00000010;
- $header = pack('vvV', $recVerInstance, $recType, $length);
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
- $this->_data = $header . $innerData;
- break;
+ $header = pack('vvV', $recVerInstance, $recType, $length);
- case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer':
- // this is a container record
-
- // initialize
- $innerData = '';
-
- // initialize spape offsets
- $totalSize = 8;
- $spOffsets = array();
- $spTypes = array();
-
- // treat the inner data
- foreach ($this->_object->getChildren() as $spContainer) {
- $writer = new PHPExcel_Writer_Excel5_Escher($spContainer);
- $spData = $writer->close();
- $innerData .= $spData;
-
- // save the shape offsets (where new shape records begin)
- $totalSize += strlen($spData);
- $spOffsets[] = $totalSize;
-
- $spTypes = array_merge($spTypes, $writer->getSpTypes());
- }
-
- // write the record
- $recVer = 0xF;
- $recInstance = 0x0000;
- $recType = 0xF003;
- $length = strlen($innerData);
-
- $recVerInstance = $recVer;
- $recVerInstance |= $recInstance << 4;
-
- $header = pack('vvV', $recVerInstance, $recType, $length);
-
- $this->_data = $header . $innerData;
- $this->_spOffsets = $spOffsets;
- $this->_spTypes = $spTypes;
- break;
-
- case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer':
- // initialize
- $data = '';
-
- // build the data
-
- // write group shape record, if necessary?
- if ($this->_object->getSpgr()) {
- $recVer = 0x1;
- $recInstance = 0x0000;
- $recType = 0xF009;
- $length = 0x00000010;
-
- $recVerInstance = $recVer;
- $recVerInstance |= $recInstance << 4;
-
- $header = pack('vvV', $recVerInstance, $recType, $length);
-
- $data .= $header . pack('VVVV', 0,0,0,0);
- }
- $this->_spTypes[] = ($this->_object->getSpType());
-
- // write the shape record
- $recVer = 0x2;
- $recInstance = $this->_object->getSpType(); // shape type
- $recType = 0xF00A;
- $length = 0x00000008;
-
- $recVerInstance = $recVer;
- $recVerInstance |= $recInstance << 4;
-
- $header = pack('vvV', $recVerInstance, $recType, $length);
-
- $data .= $header . pack('VV', $this->_object->getSpId(), $this->_object->getSpgr() ? 0x0005 : 0x0A00);
-
-
- // the options
- if ($this->_object->getOPTCollection()) {
- $optData = '';
-
- $recVer = 0x3;
- $recInstance = count($this->_object->getOPTCollection());
- $recType = 0xF00B;
- foreach ($this->_object->getOPTCollection() as $property => $value) {
- $optData .= pack('vV', $property, $value);
+ $data .= $header . pack('VVVV', 0,0,0,0);
}
- $length = strlen($optData);
+ $this->_spTypes[] = ($this->_object->getSpType());
+
+ // write the shape record
+ $recVer = 0x2;
+ $recInstance = $this->_object->getSpType(); // shape type
+ $recType = 0xF00A;
+ $length = 0x00000008;
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
- $data .= $header . $optData;
- }
- // the client anchor
- if ($this->_object->getStartCoordinates()) {
- $clientAnchorData = '';
+ $data .= $header . pack('VV', $this->_object->getSpId(), $this->_object->getSpgr() ? 0x0005 : 0x0A00);
- $recVer = 0x0;
- $recInstance = 0x0;
- $recType = 0xF010;
- // start coordinates
- list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getStartCoordinates());
- $c1 = PHPExcel_Cell::columnIndexFromString($column) - 1;
- $r1 = $row - 1;
+ // the options
+ if ($this->_object->getOPTCollection()) {
+ $optData = '';
- // start offsetX
- $startOffsetX = $this->_object->getStartOffsetX();
+ $recVer = 0x3;
+ $recInstance = count($this->_object->getOPTCollection());
+ $recType = 0xF00B;
+ foreach ($this->_object->getOPTCollection() as $property => $value) {
+ $optData .= pack('vV', $property, $value);
+ }
+ $length = strlen($optData);
- // start offsetY
- $startOffsetY = $this->_object->getStartOffsetY();
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
- // end coordinates
- list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getEndCoordinates());
- $c2 = PHPExcel_Cell::columnIndexFromString($column) - 1;
- $r2 = $row - 1;
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+ $data .= $header . $optData;
+ }
- // end offsetX
- $endOffsetX = $this->_object->getEndOffsetX();
+ // the client anchor
+ if ($this->_object->getStartCoordinates()) {
+ $clientAnchorData = '';
- // end offsetY
- $endOffsetY = $this->_object->getEndOffsetY();
+ $recVer = 0x0;
+ $recInstance = 0x0;
+ $recType = 0xF010;
- $clientAnchorData = pack('vvvvvvvvv', $this->_object->getSpFlag(),
- $c1, $startOffsetX, $r1, $startOffsetY,
- $c2, $endOffsetX, $r2, $endOffsetY);
-
- $length = strlen($clientAnchorData);
+ // start coordinates
+ list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getStartCoordinates());
+ $c1 = PHPExcel_Cell::columnIndexFromString($column) - 1;
+ $r1 = $row - 1;
+
+ // start offsetX
+ $startOffsetX = $this->_object->getStartOffsetX();
+
+ // start offsetY
+ $startOffsetY = $this->_object->getStartOffsetY();
+
+ // end coordinates
+ list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getEndCoordinates());
+ $c2 = PHPExcel_Cell::columnIndexFromString($column) - 1;
+ $r2 = $row - 1;
+
+ // end offsetX
+ $endOffsetX = $this->_object->getEndOffsetX();
+
+ // end offsetY
+ $endOffsetY = $this->_object->getEndOffsetY();
+
+ $clientAnchorData = pack('vvvvvvvvv', $this->_object->getSpFlag(), $c1, $startOffsetX, $r1, $startOffsetY, $c2, $endOffsetX, $r2, $endOffsetY);
+
+ $length = strlen($clientAnchorData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+ $data .= $header . $clientAnchorData;
+ }
+
+ // the client data, just empty for now
+ if (!$this->_object->getSpgr()) {
+ $clientDataData = '';
+
+ $recVer = 0x0;
+ $recInstance = 0x0;
+ $recType = 0xF011;
+
+ $length = strlen($clientDataData);
+
+ $recVerInstance = $recVer;
+ $recVerInstance |= $recInstance << 4;
+
+ $header = pack('vvV', $recVerInstance, $recType, $length);
+ $data .= $header . $clientDataData;
+ }
+
+ // write the record
+ $recVer = 0xF;
+ $recInstance = 0x0000;
+ $recType = 0xF004;
+ $length = strlen($data);
$recVerInstance = $recVer;
$recVerInstance |= $recInstance << 4;
$header = pack('vvV', $recVerInstance, $recType, $length);
- $data .= $header . $clientAnchorData;
- }
-
- // the client data, just empty for now
- if (!$this->_object->getSpgr()) {
- $clientDataData = '';
-
- $recVer = 0x0;
- $recInstance = 0x0;
- $recType = 0xF011;
-
- $length = strlen($clientDataData);
-
- $recVerInstance = $recVer;
- $recVerInstance |= $recInstance << 4;
-
- $header = pack('vvV', $recVerInstance, $recType, $length);
- $data .= $header . $clientDataData;
- }
-
- // write the record
- $recVer = 0xF;
- $recInstance = 0x0000;
- $recType = 0xF004;
- $length = strlen($data);
-
- $recVerInstance = $recVer;
- $recVerInstance |= $recInstance << 4;
-
- $header = pack('vvV', $recVerInstance, $recType, $length);
-
- $this->_data = $header . $data;
- break;
+ $this->_data = $header . $data;
+ break;
}
return $this->_data;
@@ -532,6 +519,4 @@ class PHPExcel_Writer_Excel5_Escher
{
return $this->_spTypes;
}
-
-
}
diff --git a/Classes/PHPExcel/Writer/Excel5/Font.php b/Classes/PHPExcel/Writer/Excel5/Font.php
index d4543db1..a95e6455 100644
--- a/Classes/PHPExcel/Writer/Excel5/Font.php
+++ b/Classes/PHPExcel/Writer/Excel5/Font.php
@@ -107,12 +107,17 @@ class PHPExcel_Writer_Excel5_Font
$grbit |= 0x20;
}
- $data = pack("vvvvvCCCC",
- $this->_font->getSize() * 20, // Fontsize (in twips)
+ $data = pack(
+ "vvvvvCCCC",
+ // Fontsize (in twips)
+ $this->_font->getSize() * 20,
$grbit,
- $icv, // Colour
- self::_mapBold($this->_font->getBold()), // Font weight
- $sss, // Superscript/Subscript
+ // Colour
+ $icv,
+ // Font weight
+ self::_mapBold($this->_font->getBold()),
+ // Superscript/Subscript
+ $sss,
self::_mapUnderline($this->_font->getUnderline()),
$bFamily,
$bCharSet,
@@ -132,7 +137,8 @@ class PHPExcel_Writer_Excel5_Font
* @param boolean $bold
* @return int
*/
- private static function _mapBold($bold) {
+ private static function _mapBold($bold)
+ {
if ($bold) {
return 0x2BC; // 700 = Bold font weight
}
@@ -144,22 +150,24 @@ class PHPExcel_Writer_Excel5_Font
* @static array of int
*
*/
- private static $_mapUnderline = array( PHPExcel_Style_Font::UNDERLINE_NONE => 0x00,
- PHPExcel_Style_Font::UNDERLINE_SINGLE => 0x01,
- PHPExcel_Style_Font::UNDERLINE_DOUBLE => 0x02,
- PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING => 0x21,
- PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING => 0x22,
- );
+ private static $_mapUnderline = array(
+ PHPExcel_Style_Font::UNDERLINE_NONE => 0x00,
+ PHPExcel_Style_Font::UNDERLINE_SINGLE => 0x01,
+ PHPExcel_Style_Font::UNDERLINE_DOUBLE => 0x02,
+ PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING => 0x21,
+ PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING => 0x22,
+ );
/**
* Map underline
*
* @param string
* @return int
*/
- private static function _mapUnderline($underline) {
- if (isset(self::$_mapUnderline[$underline]))
+ private static function _mapUnderline($underline)
+ {
+ if (isset(self::$_mapUnderline[$underline])) {
return self::$_mapUnderline[$underline];
+ }
return 0x00;
}
-
}
diff --git a/Classes/PHPExcel/Writer/Excel5/Parser.php b/Classes/PHPExcel/Writer/Excel5/Parser.php
index c9b0bef7..6a5e3e08 100644
--- a/Classes/PHPExcel/Writer/Excel5/Parser.php
+++ b/Classes/PHPExcel/Writer/Excel5/Parser.php
@@ -136,7 +136,7 @@ class PHPExcel_Writer_Excel5_Parser
*
* @access private
*/
- function _initializeHashes()
+ private function _initializeHashes()
{
// The Excel ptg indices
$this->ptg = array(
@@ -512,7 +512,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param mixed $token The token to convert.
* @return mixed the converted token on success
*/
- function _convert($token)
+ private function _convert($token)
{
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) {
return $this->_convertString($token);
@@ -521,15 +521,15 @@ class PHPExcel_Writer_Excel5_Parser
return $this->_convertNumber($token);
// match references like A1 or $A$1
- } elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/',$token)) {
+ } elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/', $token)) {
return $this->_convertRef2d($token);
// match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1
- } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u",$token)) {
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
return $this->_convertRef3d($token);
// match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1
- } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u",$token)) {
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
return $this->_convertRef3d($token);
// match ranges like A1:B2 or $A$1:$B$2
@@ -537,11 +537,11 @@ class PHPExcel_Writer_Excel5_Parser
return $this->_convertRange2d($token);
// match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
- } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u",$token)) {
+ } elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
return $this->_convertRange3d($token);
// match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
- } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u",$token)) {
+ } elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
return $this->_convertRange3d($token);
// operators (including parentheses)
@@ -553,9 +553,9 @@ class PHPExcel_Writer_Excel5_Parser
return $this->_convertError($token);
// commented so argument number can be processed correctly. See toReversePolish().
- /*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/",$token))
+ /*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token))
{
- return($this->_convertFunction($token,$this->_func_args));
+ return($this->_convertFunction($token, $this->_func_args));
}*/
// if it's an argument, ignore the token (the argument remains)
@@ -573,7 +573,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private
* @param mixed $num an integer or double for conversion to its ptg value
*/
- function _convertNumber($num)
+ private function _convertNumber($num)
{
// Integer in the range 0..2**16-1
if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) {
@@ -593,7 +593,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $string A string for conversion to its ptg value.
* @return mixed the converted token on success
*/
- function _convertString($string)
+ private function _convertString($string)
{
// chop away beggining and ending quotes
$string = substr($string, 1, strlen($string) - 2);
@@ -613,16 +613,16 @@ class PHPExcel_Writer_Excel5_Parser
* @param integer $num_args The number of arguments the function receives.
* @return string The packed ptg for the function
*/
- function _convertFunction($token, $num_args)
+ private function _convertFunction($token, $num_args)
{
$args = $this->_functions[$token][1];
// $volatile = $this->_functions[$token][3];
- // Fixed number of args eg. TIME($i,$j,$k).
+ // Fixed number of args eg. TIME($i, $j, $k).
if ($args >= 0) {
return pack("Cv", $this->ptg['ptgFuncV'], $this->_functions[$token][0]);
}
- // Variable number of args eg. SUM($i,$j,$k, ..).
+ // Variable number of args eg. SUM($i, $j, $k, ..).
if ($args == -1) {
return pack("CCv", $this->ptg['ptgFuncVarV'], $num_args, $this->_functions[$token][0]);
}
@@ -635,7 +635,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $range An Excel range in the A1:A2
* @param int $class
*/
- function _convertRange2d($range, $class=0)
+ private function _convertRange2d($range, $class = 0)
{
// TODO: possible class value 0,1,2 check Formula.pm
@@ -673,7 +673,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $token An Excel range in the Sheet1!A1:A2 format.
* @return mixed The packed ptgArea3d token on success.
*/
- function _convertRange3d($token)
+ private function _convertRange3d($token)
{
// $class = 0; // formulas like Sheet1!$A$1:$A$2 in list type data validation need this class (0x3B)
@@ -715,7 +715,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $cell An Excel cell reference
* @return string The cell in packed() format with the corresponding ptg
*/
- function _convertRef2d($cell)
+ private function _convertRef2d($cell)
{
// $class = 2; // as far as I know, this is magick.
@@ -745,7 +745,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $cell An Excel cell reference
* @return mixed The packed ptgRef3d token on success.
*/
- function _convertRef3d($cell)
+ private function _convertRef3d($cell)
{
// $class = 2; // as far as I know, this is magick.
@@ -779,16 +779,23 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $errorCode The error code for conversion to its ptg value
* @return string The error code ptgErr
*/
- function _convertError($errorCode)
+ private function _convertError($errorCode)
{
switch ($errorCode) {
- case '#NULL!': return pack("C", 0x00);
- case '#DIV/0!': return pack("C", 0x07);
- case '#VALUE!': return pack("C", 0x0F);
- case '#REF!': return pack("C", 0x17);
- case '#NAME?': return pack("C", 0x1D);
- case '#NUM!': return pack("C", 0x24);
- case '#N/A': return pack("C", 0x2A);
+ case '#NULL!':
+ return pack("C", 0x00);
+ case '#DIV/0!':
+ return pack("C", 0x07);
+ case '#VALUE!':
+ return pack("C", 0x0F);
+ case '#REF!':
+ return pack("C", 0x17);
+ case '#NAME?':
+ return pack("C", 0x1D);
+ case '#NUM!':
+ return pack("C", 0x24);
+ case '#N/A':
+ return pack("C", 0x2A);
}
return pack("C", 0xFF);
}
@@ -801,7 +808,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $ext_ref The name of the external reference
* @return string The reference index in packed() format
*/
- function _packExtRef($ext_ref)
+ private function _packExtRef($ext_ref)
{
$ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
@@ -846,7 +853,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $ext_ref The name of the external reference
* @return mixed The reference index in packed() format on success
*/
- function _getRefIndex($ext_ref)
+ private function _getRefIndex($ext_ref)
{
$ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
@@ -906,7 +913,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $sheet_name Sheet name
* @return integer The sheet index, -1 if the sheet was not found
*/
- function _getSheetIndex($sheet_name)
+ private function _getSheetIndex($sheet_name)
{
if (!isset($this->_ext_sheets[$sheet_name])) {
return -1;
@@ -925,7 +932,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $name The name of the worksheet being added
* @param integer $index The index of the worksheet being added
*/
- function setExtSheet($name, $index)
+ public function setExtSheet($name, $index)
{
$this->_ext_sheets[$name] = $index;
}
@@ -937,7 +944,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $cell The Excel cell reference to be packed
* @return array Array containing the row and column in packed() format
*/
- function _cellToPackedRowcol($cell)
+ private function _cellToPackedRowcol($cell)
{
$cell = strtoupper($cell);
list($row, $col, $row_rel, $col_rel) = $this->_cellToRowcol($cell);
@@ -966,7 +973,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $range The Excel range to be packed
* @return array Array containing (row1,col1,row2,col2) in packed() format
*/
- function _rangeToPackedRange($range)
+ private function _rangeToPackedRange($range)
{
preg_match('/(\$)?(\d+)\:(\$)?(\d+)/', $range, $match);
// return absolute rows if there is a $ in the ref
@@ -1007,9 +1014,9 @@ class PHPExcel_Writer_Excel5_Parser
* @param string $cell The Excel cell reference in A1 format.
* @return array
*/
- function _cellToRowcol($cell)
+ private function _cellToRowcol($cell)
{
- preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/',$cell,$match);
+ preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/', $cell, $match);
// return absolute column if there is a $ in the ref
$col_rel = empty($match[1]) ? 1 : 0;
$col_ref = $match[2];
@@ -1037,7 +1044,7 @@ class PHPExcel_Writer_Excel5_Parser
*
* @access private
*/
- function _advance()
+ private function _advance()
{
$i = $this->_current_char;
$formula_length = strlen($this->_formula);
@@ -1088,7 +1095,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param mixed $token The token to check.
* @return mixed The checked token or false on failure
*/
- function _match($token)
+ private function _match($token)
{
switch($token) {
case "+":
@@ -1123,65 +1130,55 @@ class PHPExcel_Writer_Excel5_Parser
break;
default:
// if it's a reference A1 or $A$1 or $A1 or A$1
- if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$token) and
- !preg_match("/[0-9]/",$this->_lookahead) and
+ if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and
+ !preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.') and
- ($this->_lookahead != '!'))
- {
+ ($this->_lookahead != '!')) {
return $token;
}
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
- elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$token) and
- !preg_match("/[0-9]/",$this->_lookahead) and
- ($this->_lookahead != ':') and ($this->_lookahead != '.'))
- {
+ elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
+ !preg_match("/[0-9]/", $this->_lookahead) and
+ ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
return $token;
}
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
- elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$token) and
- !preg_match("/[0-9]/",$this->_lookahead) and
- ($this->_lookahead != ':') and ($this->_lookahead != '.'))
- {
+ elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
+ !preg_match("/[0-9]/", $this->_lookahead) and
+ ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
return $token;
}
// if it's a range A1:A2 or $A$1:$A$2
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) and
- !preg_match("/[0-9]/",$this->_lookahead))
- {
+ !preg_match("/[0-9]/", $this->_lookahead)) {
return $token;
}
// If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
- elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$token) and
- !preg_match("/[0-9]/",$this->_lookahead))
- {
+ elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
+ !preg_match("/[0-9]/", $this->_lookahead)) {
return $token;
}
// If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
- elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$token) and
- !preg_match("/[0-9]/",$this->_lookahead))
- {
+ elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
+ !preg_match("/[0-9]/", $this->_lookahead)) {
return $token;
}
// If it's a number (check that it's not a sheet name or range)
elseif (is_numeric($token) and
(!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and
- ($this->_lookahead != '!') and ($this->_lookahead != ':'))
- {
+ ($this->_lookahead != '!') and ($this->_lookahead != ':')) {
return $token;
}
// If it's a string (of maximum 255 characters)
- elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/",$token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0))
- {
+ elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
return $token;
}
// If it's an error code
- elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A')
- {
+ elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
return $token;
}
// if it's a function call
- elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$token) and ($this->_lookahead == "("))
- {
+ elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
return $token;
}
// It's an argument of some description (e.g. a named range),
@@ -1201,7 +1198,7 @@ class PHPExcel_Writer_Excel5_Parser
* sign (=).
* @return mixed true on success
*/
- function parse($formula)
+ public function parse($formula)
{
$this->_current_char = 0;
$this->_formula = $formula;
@@ -1218,7 +1215,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private
* @return mixed The parsed ptg'd tree on success
*/
- function _condition()
+ private function _condition()
{
$result = $this->_expression();
if ($this->_current_token == "<") {
@@ -1264,7 +1261,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private
* @return mixed The parsed ptg'd tree on success
*/
- function _expression()
+ private function _expression()
{
// If it's a string return a string node
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->_current_token)) {
@@ -1323,7 +1320,7 @@ class PHPExcel_Writer_Excel5_Parser
* @see _fact()
* @return array The parsed ptg'd tree
*/
- function _parenthesizedExpression()
+ private function _parenthesizedExpression()
{
$result = $this->_createTree('ptgParen', $this->_expression(), '');
return $result;
@@ -1336,7 +1333,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private
* @return mixed The parsed ptg'd tree on success
*/
- function _term()
+ private function _term()
{
$result = $this->_fact();
while (($this->_current_token == "*") or
@@ -1366,7 +1363,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private
* @return mixed The parsed ptg'd tree on success
*/
- function _fact()
+ private function _fact()
{
if ($this->_current_token == "(") {
$this->_advance(); // eat the "("
@@ -1378,29 +1375,29 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// if it's a reference
- if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$this->_current_token))
+ if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $this->_current_token))
{
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
- elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$this->_current_token))
+ elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token))
{
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
- elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$this->_current_token))
+ elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token))
{
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// if it's a range A1:B2 or $A$1:$B$2
- elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/',$this->_current_token) or
- preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/',$this->_current_token))
+ elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
+ preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token))
{
// must be an error?
$result = $this->_createTree($this->_current_token, '', '');
@@ -1408,7 +1405,7 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
- elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$this->_current_token))
+ elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token))
{
// must be an error?
//$result = $this->_current_token;
@@ -1417,7 +1414,7 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
- elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$this->_current_token))
+ elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token))
{
// must be an error?
//$result = $this->_current_token;
@@ -1438,7 +1435,7 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// if it's a function call
- elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$this->_current_token))
+ elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token))
{
$result = $this->_func();
return $result;
@@ -1455,7 +1452,7 @@ class PHPExcel_Writer_Excel5_Parser
* @access private
* @return mixed The parsed ptg'd tree on success
*/
- function _func()
+ private function _func()
{
$num_args = 0; // number of arguments received
$function = strtoupper($this->_current_token);
@@ -1485,7 +1482,7 @@ class PHPExcel_Writer_Excel5_Parser
throw new PHPExcel_Writer_Exception("Function $function() doesn't exist");
}
$args = $this->_functions[$function][1];
- // If fixed number of args eg. TIME($i,$j,$k). Check that the number of args is valid.
+ // If fixed number of args eg. TIME($i, $j, $k). Check that the number of args is valid.
if (($args >= 0) and ($args != $num_args)) {
throw new PHPExcel_Writer_Exception("Incorrect number of arguments in function $function() ");
}
@@ -1505,7 +1502,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param mixed $right The right array (sub-tree) or a final node.
* @return array A tree
*/
- function _createTree($value, $left, $right)
+ private function _createTree($value, $left, $right)
{
return array('value' => $value, 'left' => $left, 'right' => $right);
}
@@ -1537,7 +1534,7 @@ class PHPExcel_Writer_Excel5_Parser
* @param array $tree The optional tree to convert.
* @return string The tree in reverse polish notation
*/
- function toReversePolish($tree = array())
+ public function toReversePolish($tree = array())
{
$polish = ""; // the string we are going to return
if (empty($tree)) { // If it's the first call use _parse_tree
@@ -1559,9 +1556,9 @@ class PHPExcel_Writer_Excel5_Parser
$polish .= $converted_tree;
}
// if it's a function convert it here (so we can set it's arguments)
- if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/",$tree['value']) and
- !preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/',$tree['value']) and
- !preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/",$tree['value']) and
+ if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/", $tree['value']) and
+ !preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) and
+ !preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/", $tree['value']) and
!is_numeric($tree['value']) and
!isset($this->ptg[$tree['value']]))
{
@@ -1579,5 +1576,4 @@ class PHPExcel_Writer_Excel5_Parser
$polish .= $converted_tree;
return $polish;
}
-
}
diff --git a/Classes/PHPExcel/Writer/Excel5/Workbook.php b/Classes/PHPExcel/Writer/Excel5/Workbook.php
index f5a47a43..24c5cccc 100644
--- a/Classes/PHPExcel/Writer/Excel5/Workbook.php
+++ b/Classes/PHPExcel/Writer/Excel5/Workbook.php
@@ -200,9 +200,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
* @param array &$colors Colour Table
* @param mixed $parser The formula parser created for the Workbook
*/
- public function __construct(PHPExcel $phpExcel = null,
- &$str_total, &$str_unique, &$str_table, &$colors,
- $parser )
+ public function __construct(PHPExcel $phpExcel = null, &$str_total, &$str_unique, &$str_table, &$colors, $parser)
{
// It needs to call its parent's constructor explicitly
parent::__construct();
@@ -303,7 +301,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
public function _addFont(PHPExcel_Style_Font $font)
{
$fontHashCode = $font->getHashCode();
- if(isset($this->_addedFonts[$fontHashCode])){
+ if (isset($this->_addedFonts[$fontHashCode])) {
$fontIndex = $this->_addedFonts[$fontHashCode];
} else {
$countFonts = count($this->_fontWriters);
@@ -324,7 +322,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $rgb E.g. 'FF00AA'
* @return int Color index
*/
- private function _addColor($rgb) {
+ private function _addColor($rgb)
+ {
if (!isset($this->_colors[$rgb])) {
if (count($this->_colors) < 57) {
// then we add a custom color altering the palette
@@ -354,7 +353,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
*
* @access private
*/
- function _setPaletteXl97()
+ private function _setPaletteXl97()
{
$this->_palette = array(
0x08 => array(0x00, 0x00, 0x00, 0x00),
@@ -477,7 +476,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
*
* @access private
*/
- function _calcSheetOffsets()
+ private function _calcSheetOffsets()
{
$boundsheet_length = 10; // fixed length for a BOUNDSHEET record
@@ -583,7 +582,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$print_rowmax,
$print_colmin,
$print_colmax
- );
+ );
}
}
@@ -608,11 +607,10 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$rowmax,
$colmin,
$colmax
- );
+ );
// (exclusive) either repeatColumns or repeatRows
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
-
// Columns to repeat
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
@@ -640,7 +638,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$rowmax,
$colmin,
$colmax
- );
+ );
}
}
}
@@ -658,7 +656,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// Loop named ranges
$namedRanges = $this->_phpExcel->getNamedRanges();
foreach ($namedRanges as $namedRange) {
-
// Create absolute coordinate
$range = PHPExcel_Cell::splitRange($namedRange->getRange());
for ($i = 0; $i < count($range); $i++) {
@@ -688,7 +685,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
}
$chunk .= $this->writeData($this->_writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false));
- } catch(PHPExcel_Exception $e) {
+ } catch (PHPExcel_Exception $e) {
// do nothing
}
}
@@ -721,7 +718,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// (exclusive) either repeatColumns or repeatRows
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
-
// Columns to repeat
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
@@ -785,7 +781,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
for ($i = 0; $i < $total_worksheets; ++$i) {
$sheetAutoFilter = $this->_phpExcel->getSheet($i)->getAutoFilter();
$autoFilterRange = $sheetAutoFilter->getRange();
- if(!empty($autoFilterRange)) {
+ if (!empty($autoFilterRange)) {
$rangeBounds = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
//Autofilter built in name
@@ -842,19 +838,21 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
* @param boolean $isHidden
* @return string Complete binary record data
* */
- private function _writeShortNameBiff8($name, $sheetIndex = 0, $rangeBounds, $isHidden = false){
+ private function _writeShortNameBiff8($name, $sheetIndex = 0, $rangeBounds, $isHidden = false)
+ {
$record = 0x0018;
// option flags
$options = ($isHidden ? 0x21 : 0x00);
$extra = pack('Cvvvvv',
- 0x3B,
- $sheetIndex - 1,
- $rangeBounds[0][1] - 1,
- $rangeBounds[1][1] - 1,
- $rangeBounds[0][0] - 1,
- $rangeBounds[1][0] - 1);
+ 0x3B,
+ $sheetIndex - 1,
+ $rangeBounds[0][1] - 1,
+ $rangeBounds[1][1] - 1,
+ $rangeBounds[0][0] - 1,
+ $rangeBounds[1][0] - 1
+ );
// size of the formula (in bytes)
$sz = strlen($extra);
@@ -879,7 +877,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$cv = $this->_codepage; // The code page
$header = pack('vv', $record, $length);
- $data = pack('v', $cv);
+ $data = pack('v', $cv);
$this->_append($header . $data);
}
@@ -909,10 +907,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$itabCur = $this->_phpExcel->getActiveSheetIndex(); // Active worksheet
$header = pack("vv", $record, $length);
- $data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn,
- $grbit,
- $itabCur, $itabFirst,
- $ctabsel, $wTabRatio);
+ $data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn, $grbit, $itabCur, $itabFirst, $ctabsel, $wTabRatio);
$this->_append($header . $data);
}
@@ -929,10 +924,18 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// sheet state
switch ($sheet->getSheetState()) {
- case PHPExcel_Worksheet::SHEETSTATE_VISIBLE: $ss = 0x00; break;
- case PHPExcel_Worksheet::SHEETSTATE_HIDDEN: $ss = 0x01; break;
- case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN: $ss = 0x02; break;
- default: $ss = 0x00; break;
+ case PHPExcel_Worksheet::SHEETSTATE_VISIBLE:
+ $ss = 0x00;
+ break;
+ case PHPExcel_Worksheet::SHEETSTATE_HIDDEN:
+ $ss = 0x01;
+ break;
+ case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN:
+ $ss = 0x02;
+ break;
+ default:
+ $ss = 0x00;
+ break;
}
// sheet type
@@ -944,7 +947,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheetname);
$length = strlen($data);
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$this->_append($header . $data);
}
@@ -973,7 +976,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$length = 2 + 6 * $total_references; // Number of bytes to follow
$supbook_index = 0; // FIXME: only using internal SUPBOOK record
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack('v', $total_references);
for ($i = 0; $i < $total_references; ++$i) {
$data .= $this->_parser->_references[$i];
@@ -993,7 +996,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$BuiltIn = 0x00; // Built-in style
$iLevel = 0xff; // Outline style level
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("vCC", $ixfe, $BuiltIn, $iLevel);
$this->_append($header . $data);
}
@@ -1051,7 +1054,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$length = 0x0002; // Number of bytes to follow
$header = pack("vv", $record, $length);
- $data = pack("v", $cxals);
+ $data = pack("v", $cxals);
$this->_append($header . $data);
}
@@ -1072,7 +1075,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$cch = strlen($sheetname); // Length of sheet name
$rgch = 0x03; // Filename encoding
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("CC", $cch, $rgch);
$this->_append($header . $data . $sheetname);
}
@@ -1177,7 +1180,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$unknown07 = 0x1087;
$unknown08 = 0x8008;
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("v", $grbit);
$data .= pack("C", $chKey);
$data .= pack("C", $cch);
@@ -1232,7 +1235,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$record = 0x008C; // Record identifier
$length = 4; // Number of bytes to follow
- $header = pack('vv', $record, $length);
+ $header = pack('vv', $record, $length);
/* using the same country code always for simplicity */
$data = pack('vv', $this->_country_code, $this->_country_code);
//$this->_append($header . $data);
@@ -1249,7 +1252,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$record = 0x01C1; // Record identifier
$length = 8; // Number of bytes to follow
- $header = pack('vv', $record, $length);
+ $header = pack('vv', $record, $length);
// by inspection of real Excel files, MS Office Excel 2007 writes this
$data = pack('VV', 0x000001C1, 0x00001E667);
@@ -1276,7 +1279,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
}
}
- $header = pack("vvv", $record, $length, $ccv);
+ $header = pack("vvv", $record, $length, $ccv);
$this->_append($header . $data);
}
@@ -1307,7 +1310,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// loop through all (unique) strings in shared strings table
foreach (array_keys($this->_str_table) as $string) {
-
// here $string is a BIFF8 encoded string
// length = character count
@@ -1320,7 +1322,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$finished = false;
while ($finished === false) {
-
// normally, there will be only one cycle, but if string cannot immediately be written as is
// there will be need for more than one cylcle, if string longer than one record data block, there
// may be need for even more cycles
@@ -1369,7 +1370,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$effective_space_remaining = $space_remaining;
// for uncompressed strings, sometimes effective space remaining is reduced by 1
- if ( $encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1 ) {
+ if ($encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1) {
--$effective_space_remaining;
}
@@ -1419,10 +1420,9 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$record = 0x00EB;
$length = strlen($data);
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
return $this->writeData($header . $data);
-
} else {
return '';
}
diff --git a/Classes/PHPExcel/Writer/Excel5/Worksheet.php b/Classes/PHPExcel/Writer/Excel5/Worksheet.php
index f869abde..6ea6ca59 100644
--- a/Classes/PHPExcel/Writer/Excel5/Worksheet.php
+++ b/Classes/PHPExcel/Writer/Excel5/Worksheet.php
@@ -211,8 +211,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $phpSheet The worksheet to write
* @param PHPExcel_Worksheet $phpSheet
*/
- public function __construct(&$str_total, &$str_unique, &$str_table, &$colors,
- $parser, $preCalculateFormulas, $phpSheet)
+ public function __construct(&$str_total, &$str_unique, &$str_table, &$colors, $parser, $preCalculateFormulas, $phpSheet)
{
// It needs to call its parent's constructor explicitly
parent::__construct();
@@ -261,7 +260,9 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$this->_lastColumnIndex = PHPExcel_Cell::columnIndexFromString($maxC);
// if ($this->_firstColumnIndex > 255) $this->_firstColumnIndex = 255;
- if ($this->_lastColumnIndex > 255) $this->_lastColumnIndex = 255;
+ if ($this->_lastColumnIndex > 255) {
+ $this->_lastColumnIndex = 255;
+ }
$this->_countCellStyleXfs = count($phpSheet->getParent()->getCellStyleXfCollection());
}
@@ -273,7 +274,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @access public
* @see PHPExcel_Writer_Excel5_Workbook::storeWorkbook()
*/
- function close()
+ public function close()
{
$_phpSheet = $this->_phpSheet;
@@ -402,7 +403,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Row dimensions
foreach ($_phpSheet->getRowDimensions() as $rowDimension) {
$xfIndex = $rowDimension->getXfIndex() + 15; // there are 15 cellXfs
- $this->_writeRow( $rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), $xfIndex, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel() );
+ $this->_writeRow($rowDimension->getRowIndex() - 1, $rowDimension->getRowHeight(), $xfIndex, ($rowDimension->getVisible() ? '0' : '1'), $rowDimension->getOutlineLevel());
}
// Write Cells
@@ -431,8 +432,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// FONT Index
if ($element instanceof PHPExcel_RichText_Run) {
$str_fontidx = $this->_fntHashIndex[$element->getFont()->getHashCode()];
- }
- else {
+ } else {
$str_fontidx = 0;
}
$arrcRun[] = array('strlen' => $str_pos, 'fontidx' => $str_fontidx);
@@ -500,11 +500,11 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$url = $hyperlink->getUrl();
- if ( strpos($url, 'sheet://') !== false ) {
+ if (strpos($url, 'sheet://') !== false) {
// internal to current workbook
$url = str_replace('sheet://', 'internal:', $url);
- } else if ( preg_match('/^(http:|https:|ftp:|mailto:)/', $url) ) {
+ } else if (preg_match('/^(http:|https:|ftp:|mailto:)/', $url)) {
// URL
// $url = $url;
@@ -524,7 +524,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$this->_writeRangeProtection();
$arrConditionalStyles = $_phpSheet->getConditionalStylesCollection();
- if(!empty($arrConditionalStyles)){
+ if (!empty($arrConditionalStyles)) {
$arrConditional = array();
// @todo CFRule & CFHeader
// Write CFHEADER record
@@ -532,9 +532,9 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Write ConditionalFormattingTable records
foreach ($arrConditionalStyles as $cellCoordinate => $conditionalStyles) {
foreach ($conditionalStyles as $conditional) {
- if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
- || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){
- if(!in_array($conditional->getHashCode(), $arrConditional)){
+ if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
+ || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) {
+ if (!in_array($conditional->getHashCode(), $arrConditional)) {
$arrConditional[] = $conditional->getHashCode();
// Write CFRULE record
$this->_writeCFRule($conditional);
@@ -572,12 +572,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$firstCellCoordinates = PHPExcel_Cell::coordinateFromString($firstCell); // e.g. array(0, 1)
$lastCellCoordinates = PHPExcel_Cell::coordinateFromString($lastCell); // e.g. array(1, 6)
- return(pack('vvvv',
- $firstCellCoordinates[1] - 1,
- $lastCellCoordinates[1] - 1,
- PHPExcel_Cell::columnIndexFromString($firstCellCoordinates[0]) - 1,
- PHPExcel_Cell::columnIndexFromString($lastCellCoordinates[0]) - 1
- ));
+ return pack('vvvv', $firstCellCoordinates[1] - 1, $lastCellCoordinates[1] - 1, PHPExcel_Cell::columnIndexFromString($firstCellCoordinates[0]) - 1, PHPExcel_Cell::columnIndexFromString($lastCellCoordinates[0]) - 1);
}
/**
@@ -586,7 +581,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
*
* @return string The data
*/
- function getData()
+ public function getData()
{
$buffer = 4096;
@@ -606,7 +601,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @access public
* @param integer $print Whether to print the headers or not. Defaults to 1 (print).
*/
- function printRowColHeaders($print = 1)
+ public function printRowColHeaders($print = 1)
{
$this->_print_headers = $print;
}
@@ -620,7 +615,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param bool $symbols_right
* @param bool $auto_style
*/
- function setOutline($visible = true, $symbols_below = true, $symbols_right = true, $auto_style = false)
+ public function setOutline($visible = true, $symbols_below = true, $symbols_right = true, $auto_style = false)
{
$this->_outline_on = $visible;
$this->_outline_below = $symbols_below;
@@ -631,7 +626,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
if ($this->_outline_on) {
$this->_outline_on = 1;
}
- }
+ }
/**
* Write a double to the specified row and column (zero indexed).
@@ -652,9 +647,9 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$record = 0x0203; // Record identifier
$length = 0x000E; // Number of bytes to follow
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("vvv", $row, $col, $xfIndex);
- $xl_double = pack("d", $num);
+ $xl_double = pack("d", $num);
if (self::getByteOrder()) { // if it's Big Endian
$xl_double = strrev($xl_double);
}
@@ -685,7 +680,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param mixed $xfIndex The XF format index for the cell
* @param array $arrcRun Index to Font record and characters beginning
*/
- private function _writeRichTextString($row, $col, $str, $xfIndex, $arrcRun){
+ private function _writeRichTextString($row, $col, $str, $xfIndex, $arrcRun)
+ {
$record = 0x00FD; // Record identifier
$length = 0x000A; // Bytes to follow
$str = PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($str, $arrcRun);
@@ -696,7 +692,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
}
$this->_str_total++;
- $header = pack('vv', $record, $length);
+ $header = pack('vv', $record, $length);
$data = pack('vvvV', $row, $col, $xfIndex, $this->_str_table[$str]);
$this->_append($header.$data);
}
@@ -731,7 +727,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$str_error = -3;
}
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("vvvv", $row, $col, $xfIndex, $strlen);
$this->_append($header . $data . $str);
return($str_error);
@@ -765,7 +761,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
}
$this->_str_total++;
- $header = pack('vv', $record, $length);
+ $header = pack('vv', $record, $length);
$data = pack('vvvV', $row, $col, $xfIndex, $this->_str_table[$str]);
$this->_append($header.$data);
}
@@ -786,14 +782,14 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Length for this record is no more than 2048 + 6
$length = 0x0006 + min($note_length, 2048);
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("vvv", $row, $col, $note_length);
$this->_append($header . $data . substr($note, 0, 2048));
for ($i = $max_length; $i < $note_length; $i += $max_length) {
$chunk = substr($note, $i, $max_length);
$length = 0x0006 + strlen($chunk);
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("vvv", -1, 0, strlen($chunk));
$this->_append($header.$data.$chunk);
}
@@ -816,12 +812,12 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param integer $col Zero indexed column
* @param mixed $xfIndex The XF format index
*/
- function _writeBlank($row, $col, $xfIndex)
+ public function _writeBlank($row, $col, $xfIndex)
{
$record = 0x0201; // Record identifier
$length = 0x0006; // Number of bytes to follow
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("vvv", $row, $col, $xfIndex);
$this->_append($header . $data);
return 0;
@@ -841,7 +837,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$record = 0x0205;
$length = 8;
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("vvvCC", $row, $col, $xfIndex, $value, $isError);
$this->_append($header . $data);
return 0;
@@ -905,7 +901,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Strip the '=' or '@' sign at the beginning of the formula string
if ($formula{0} == '=') {
- $formula = substr($formula,1);
+ $formula = substr($formula, 1);
} else {
// Error handling
$this->_writeString($row, $col, 'Unrecognised character for formula');
@@ -920,7 +916,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$formlen = strlen($formula); // Length of the binary string
$length = 0x16 + $formlen; // Length of the record data
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("vvv", $row, $col, $xfIndex)
. $num
@@ -997,7 +993,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $url URL string
* @return integer
*/
- function _writeUrlRange($row1, $col1, $row2, $col2, $url)
+ public function _writeUrlRange($row1, $col1, $row2, $col2, $url)
{
// Check for internal/external sheet links or default to web link
if (preg_match('[^internal:]', $url)) {
@@ -1023,7 +1019,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $url URL string
* @return integer
*/
- function _writeUrlWeb($row1, $col1, $row2, $col2, $url)
+ public function _writeUrlWeb($row1, $col1, $row2, $col2, $url)
{
$record = 0x01B8; // Record identifier
$length = 0x00000; // Bytes to follow
@@ -1046,7 +1042,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$length = 0x34 + strlen($url);
// Pack the header data
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("vvvv", $row1, $row2, $col1, $col2);
// Write the packed data
@@ -1068,7 +1064,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $url URL string
* @return integer
*/
- function _writeUrlInternal($row1, $col1, $row2, $col2, $url)
+ public function _writeUrlInternal($row1, $col1, $row2, $col2, $url)
{
$record = 0x01B8; // Record identifier
$length = 0x00000; // Bytes to follow
@@ -1095,7 +1091,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$length = 0x24 + strlen($url);
// Pack the header data
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("vvvv", $row1, $row2, $col1, $col2);
// Write the packed data
@@ -1121,7 +1117,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $url URL string
* @return integer
*/
- function _writeUrlExternal($row1, $col1, $row2, $col2, $url)
+ public function _writeUrlExternal($row1, $col1, $row2, $col2, $url)
{
// Network drives are different. We will handle them separately
// MS/Novell network drives and shares start with \\
@@ -1143,7 +1139,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// otherwise, absolute
$absolute = 0x00; // relative path
- if ( preg_match('/^[A-Z]:/', $url) ) {
+ if (preg_match('/^[A-Z]:/', $url)) {
$absolute = 0x02; // absolute path on Windows, e.g. C:\...
}
$link_type = 0x01 | $absolute;
@@ -1171,15 +1167,15 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$dir_long = $dir_long . "\0";
// Pack the lengths of the dir strings
- $dir_short_len = pack("V", strlen($dir_short) );
- $dir_long_len = pack("V", strlen($dir_long) );
- $stream_len = pack("V", 0);//strlen($dir_long) + 0x06);
+ $dir_short_len = pack("V", strlen($dir_short));
+ $dir_long_len = pack("V", strlen($dir_long));
+ $stream_len = pack("V", 0); //strlen($dir_long) + 0x06);
// Pack the undocumented parts of the hyperlink stream
- $unknown1 = pack("H*",'D0C9EA79F9BACE118C8200AA004BA90B02000000' );
- $unknown2 = pack("H*",'0303000000000000C000000000000046' );
- $unknown3 = pack("H*",'FFFFADDE000000000000000000000000000000000000000');
- $unknown4 = pack("v", 0x03 );
+ $unknown1 = pack("H*", 'D0C9EA79F9BACE118C8200AA004BA90B02000000');
+ $unknown2 = pack("H*", '0303000000000000C000000000000046');
+ $unknown3 = pack("H*", 'FFFFADDE000000000000000000000000000000000000000');
+ $unknown4 = pack("v", 0x03);
// Pack the main data stream
$data = pack("vvvv", $row1, $row2, $col1, $col2) .
@@ -1228,7 +1224,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$grbit = 0x0000; // Option flags
$ixfe = $xfIndex;
- if ( $height < 0 ){
+ if ($height < 0) {
$height = null;
}
@@ -1257,9 +1253,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
}
$grbit |= 0x0100;
- $header = pack("vv", $record, $length);
- $data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw,
- $irwMac,$reserved, $grbit, $ixfe);
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw, $irwMac, $reserved, $grbit, $ixfe);
$this->_append($header.$data);
}
@@ -1271,13 +1266,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$record = 0x0200; // Record identifier
$length = 0x000E;
- $data = pack('VVvvv'
- , $this->_firstRowIndex
- , $this->_lastRowIndex + 1
- , $this->_firstColumnIndex
- , $this->_lastColumnIndex + 1
- , 0x0000 // reserved
- );
+ $data = pack('VVvvv', $this->_firstRowIndex, $this->_lastRowIndex + 1, $this->_firstColumnIndex, $this->_lastColumnIndex + 1, 0x0000 // reserved);
$header = pack("vv", $record, $length);
$this->_append($header.$data);
@@ -1324,12 +1313,12 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$grbit |= $fPaged << 10;
$grbit |= $fPageBreakPreview << 11;
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("vvv", $grbit, $rwTop, $colLeft);
// FIXME !!!
$rgbHdr = 0x0040; // Row/column heading and gridline color index
- $zoom_factor_page_break = ($fPageBreakPreview? $this->_phpSheet->getSheetView()->getZoomScale() : 0x0000);
+ $zoom_factor_page_break = ($fPageBreakPreview ? $this->_phpSheet->getSheetView()->getZoomScale() : 0x0000);
$zoom_factor_normal = $this->_phpSheet->getSheetView()->getZoomScaleNormal();
$data .= pack("vvvvV", $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000);
@@ -1355,7 +1344,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$length = 0x0004; // Number of bytes to follow
$header = pack("vv", $record, $length);
- $data = pack("vv", 1, $defaultRowHeight);
+ $data = pack("vv", 1, $defaultRowHeight);
$this->_append($header . $data);
}
@@ -1427,9 +1416,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$level = max(0, min($level, 7));
$grbit |= $level << 8;
- $header = pack("vv", $record, $length);
- $data = pack("vvvvvv", $colFirst, $colLast, $coldx,
- $ixfe, $grbit, $reserved);
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvvvv", $colFirst, $colLast, $coldx, $ixfe, $grbit, $reserved);
$this->_append($header.$data);
}
@@ -1459,10 +1447,10 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// make sure we are not out of bounds
$colFirst = min($colFirst, 255);
- $colLast = min($colLast, 255);
+ $colLast = min($colLast, 255);
$rwFirst = min($rwFirst, 65535);
- $rwLast = min($rwLast, 65535);
+ $rwLast = min($rwLast, 65535);
$record = 0x001D; // Record identifier
$length = 0x000F; // Number of bytes to follow
@@ -1489,11 +1477,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
list($colFirst, $colLast) = array($colLast, $colFirst);
}
- $header = pack("vv", $record, $length);
- $data = pack("CvvvvvvCC", $pnn, $rwAct, $colAct,
- $irefAct, $cref,
- $rwFirst, $rwLast,
- $colFirst, $colLast);
+ $header = pack("vv", $record, $length);
+ $data = pack("CvvvvvvCC", $pnn, $rwAct, $colAct, $irefAct, $cref, $rwFirst, $rwLast, $colFirst, $colLast);
$this->_append($header . $data);
}
@@ -1561,14 +1546,14 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
}
$recordData = pack(
- 'vvVVVvv'
- , 0x0862
- , 0x0000 // unused
- , 0x00000000 // unused
- , 0x00000000 // unused
- , 0x00000014 // size of record data
- , $this->_colors[$this->_phpSheet->getTabColor()->getRGB()] // color index
- , 0x0000 // unused
+ 'vvVVVvv',
+ 0x0862,
+ 0x0000, // unused
+ 0x00000000, // unused
+ 0x00000000, // unused
+ 0x00000014, // size of record data
+ $this->_colors[$this->_phpSheet->getTabColor()->getRGB()], // color index
+ 0x0000 // unused
);
$length = strlen($recordData);
@@ -1605,15 +1590,15 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// record data
$recordData = pack(
- 'vVVCVVvv'
- , 0x0867 // repeated record identifier
- , 0x0000 // not used
- , 0x0000 // not used
- , 0x00 // not used
- , 0x01000200 // unknown data
- , 0xFFFFFFFF // unknown data
- , $options // options
- , 0x0000 // not used
+ 'vVVCVVvv',
+ 0x0867, // repeated record identifier
+ 0x0000, // not used
+ 0x0000, // not used
+ 0x00, // not used
+ 0x01000200, // unknown data
+ 0xFFFFFFFF, // unknown data
+ $options, // options
+ 0x0000 // not used
);
$length = strlen($recordData);
@@ -1688,7 +1673,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$length = 0x0002; // Number of bytes to follow
$header = pack("vv", $record, $length);
- $data = pack("v", $count);
+ $data = pack("v", $count);
$this->_append($header . $data);
}
@@ -1718,7 +1703,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$rgch = 0x03; // Reference to a sheet in the current workbook
}
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("CC", $cch, $rgch);
$this->_append($header . $data . $sheetname);
}
@@ -1801,8 +1786,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$this->_active_pane = $pnnAct; // Used in _writeSelection
- $header = pack("vv", $record, $length);
- $data = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct);
+ $header = pack("vv", $record, $length);
+ $data = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct);
$this->_append($header . $data);
}
@@ -1861,14 +1846,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
}
$header = pack("vv", $record, $length);
- $data1 = pack("vvvvvvvv", $iPaperSize,
- $iScale,
- $iPageStart,
- $iFitWidth,
- $iFitHeight,
- $grbit,
- $iRes,
- $iVRes);
+ $data1 = pack("vvvvvvvv", $iPaperSize, $iScale, $iPageStart, $iFitWidth, $iFitHeight, $grbit, $iRes, $iVRes);
$data2 = $numHdr.$numFtr;
$data3 = pack("v", $iCopies);
$this->_append($header . $data1 . $data2 . $data3);
@@ -1935,7 +1913,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$fHCenter = $this->_phpSheet->getPageSetup()->getHorizontalCentered() ? 1 : 0; // Horizontal centering
$header = pack("vv", $record, $length);
- $data = pack("v", $fHCenter);
+ $data = pack("v", $fHCenter);
$this->_append($header.$data);
}
@@ -1951,7 +1929,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$fVCenter = $this->_phpSheet->getPageSetup()->getVerticalCentered() ? 1 : 0; // Horizontal centering
$header = pack("vv", $record, $length);
- $data = pack("v", $fVCenter);
+ $data = pack("v", $fVCenter);
$this->_append($header . $data);
}
@@ -1965,8 +1943,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$margin = $this->_phpSheet->getPageMargins()->getLeft(); // Margin in inches
- $header = pack("vv", $record, $length);
- $data = pack("d", $margin);
+ $header = pack("vv", $record, $length);
+ $data = pack("d", $margin);
if (self::getByteOrder()) { // if it's Big Endian
$data = strrev($data);
}
@@ -1984,8 +1962,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$margin = $this->_phpSheet->getPageMargins()->getRight(); // Margin in inches
- $header = pack("vv", $record, $length);
- $data = pack("d", $margin);
+ $header = pack("vv", $record, $length);
+ $data = pack("d", $margin);
if (self::getByteOrder()) { // if it's Big Endian
$data = strrev($data);
}
@@ -2003,8 +1981,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$margin = $this->_phpSheet->getPageMargins()->getTop(); // Margin in inches
- $header = pack("vv", $record, $length);
- $data = pack("d", $margin);
+ $header = pack("vv", $record, $length);
+ $data = pack("d", $margin);
if (self::getByteOrder()) { // if it's Big Endian
$data = strrev($data);
}
@@ -2022,8 +2000,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$margin = $this->_phpSheet->getPageMargins()->getBottom(); // Margin in inches
- $header = pack("vv", $record, $length);
- $data = pack("d", $margin);
+ $header = pack("vv", $record, $length);
+ $data = pack("d", $margin);
if (self::getByteOrder()) { // if it's Big Endian
$data = strrev($data);
}
@@ -2073,15 +2051,16 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$fGridSet = !$this->_phpSheet->getPrintGridlines(); // Boolean flag
- $header = pack("vv", $record, $length);
- $data = pack("v", $fGridSet);
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $fGridSet);
$this->_append($header . $data);
}
/**
* Write the AUTOFILTERINFO BIFF record. This is used to configure the number of autofilter select used in the sheet.
*/
- private function _writeAutoFilterInfo(){
+ private function _writeAutoFilterInfo()
+ {
$record = 0x009D; // Record identifier
$length = 0x0002; // Bytes to follow
@@ -2089,7 +2068,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$iNumFilters = 1 + $rangeBounds[1][0] - $rangeBounds[0][0];
$header = pack("vv", $record, $length);
- $data = pack("v", $iNumFilters);
+ $data = pack("v", $iNumFilters);
$this->_append($header . $data);
}
@@ -2100,7 +2079,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
*
* @see _writeWsbool()
*/
- private function _writeGuts()
+ private function _writeGuts()
{
$record = 0x0080; // Record identifier
$length = 0x0008; // Bytes to follow
@@ -2134,7 +2113,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
++$col_level;
}
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$data = pack("vvvv", $dxRwGut, $dxColGut, $maxRowOutlineLevel, $col_level);
$this->_append($header.$data);
@@ -2172,7 +2151,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
}
$header = pack("vv", $record, $length);
- $data = pack("v", $grbit);
+ $data = pack("v", $grbit);
$this->_append($header . $data);
}
@@ -2195,12 +2174,10 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Add to list of vertical breaks
$vbreaks[] = PHPExcel_Cell::columnIndexFromString($coordinates[0]) - 1;
break;
-
case PHPExcel_Worksheet::BREAK_ROW:
// Add to list of horizontal breaks
$hbreaks[] = $coordinates[1];
break;
-
case PHPExcel_Worksheet::BREAK_NONE:
default:
// Nothing to do
@@ -2210,7 +2187,6 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
//horizontal page breaks
if (!empty($hbreaks)) {
-
// Sort and filter array of page breaks
sort($hbreaks, SORT_NUMERIC);
if ($hbreaks[0] == 0) { // don't use first break if it's 0
@@ -2222,7 +2198,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$length = 2 + 6 * $cbrk; // Bytes to follow
$header = pack("vv", $record, $length);
- $data = pack("v", $cbrk);
+ $data = pack("v", $cbrk);
// Append each page break
foreach ($hbreaks as $hbreak) {
@@ -2234,7 +2210,6 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// vertical page breaks
if (!empty($vbreaks)) {
-
// 1000 vertical pagebreaks appears to be an internal Excel 5 limit.
// It is slightly higher in Excel 97/200, approx. 1026
$vbreaks = array_slice($vbreaks, 0, 1000);
@@ -2249,8 +2224,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$cbrk = count($vbreaks); // Number of page breaks
$length = 2 + 6 * $cbrk; // Bytes to follow
- $header = pack("vv", $record, $length);
- $data = pack("v", $cbrk);
+ $header = pack("vv", $record, $length);
+ $data = pack("v", $cbrk);
// Append each page break
foreach ($vbreaks as $vbreak) {
@@ -2277,7 +2252,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$fLock = 1; // Worksheet is protected
$header = pack("vv", $record, $length);
- $data = pack("v", $fLock);
+ $data = pack("v", $fLock);
$this->_append($header.$data);
}
@@ -2346,7 +2321,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$wPassword = hexdec($this->_phpSheet->getProtection()->getPassword()); // Encoded password
$header = pack("vv", $record, $length);
- $data = pack("v", $wPassword);
+ $data = pack("v", $wPassword);
$this->_append($header . $data);
}
@@ -2363,7 +2338,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param float $scale_x The horizontal scale
* @param float $scale_y The vertical scale
*/
- function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1)
+ public function insertBitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1)
{
$bitmap_array = (is_resource($bitmap) ? $this->_processBitmapGd($bitmap) : $this->_processBitmap($bitmap));
list($width, $height, $size, $data) = $bitmap_array; //$this->_processBitmap($bitmap);
@@ -2437,7 +2412,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param integer $width Width of image frame
* @param integer $height Height of image frame
*/
- function _positionImage($col_start, $row_start, $x1, $y1, $width, $height)
+ public function _positionImage($col_start, $row_start, $x1, $y1, $width, $height)
{
// Initialise end cell to the same as the start cell
$col_end = $col_start; // Col containing lower right corner of object
@@ -2488,10 +2463,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$x2 = $width / PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object
$y2 = $height / PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) * 256; // Distance to bottom of object
- $this->_writeObjPicture($col_start, $x1,
- $row_start, $y1,
- $col_end, $x2,
- $row_end, $y2);
+ $this->_writeObjPicture($col_start, $x1, $row_start, $y1, $col_end, $x2, $row_end, $y2);
}
/**
@@ -2507,7 +2479,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param integer $rwB Row containing bottom right corner of object
* @param integer $dyB Distance from bottom of cell
*/
- private function _writeObjPicture($colL,$dxL,$rwT,$dyT,$colR,$dxR,$rwB,$dyB)
+ private function _writeObjPicture($colL, $dxL, $rwT, $dyT, $colR, $dxR, $rwB, $dyB)
{
$record = 0x005d; // Record identifier
$length = 0x003c; // Bytes to follow
@@ -2580,12 +2552,13 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param resource $image The image to process
* @return array Array with data and properties of the bitmap
*/
- function _processBitmapGd($image) {
+ public function _processBitmapGd($image)
+ {
$width = imagesx($image);
$height = imagesy($image);
$data = pack("Vvvvv", 0x000c, $width, $height, 0x01, 0x18);
- for ($j=$height; $j--; ) {
+ for ($j=$height; $j--;) {
for ($i=0; $i < $width; ++$i) {
$color = imagecolorsforindex($image, imagecolorat($image, $i, $j));
foreach (array("red", "green", "blue") as $key) {
@@ -2610,10 +2583,10 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $bitmap The bitmap to process
* @return array Array with data and properties of the bitmap
*/
- function _processBitmap($bitmap)
+ public function _processBitmap($bitmap)
{
// Open file.
- $bmp_fd = @fopen($bitmap,"rb");
+ $bmp_fd = @fopen($bitmap, "rb");
if (!$bmp_fd) {
throw new PHPExcel_Writer_Exception("Couldn't import $bitmap");
}
@@ -2760,18 +2733,18 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$objData = '';
// ftCmo
- if($spTypes[$i] == 0x00C9){
+ if ($spTypes[$i] == 0x00C9) {
// Add ftCmo (common object data) subobject
$objData .=
- pack('vvvvvVVV'
- , 0x0015 // 0x0015 = ftCmo
- , 0x0012 // length of ftCmo data
- , 0x0014 // object type, 0x0014 = filter
- , $i // object id number, Excel seems to use 1-based index, local for the sheet
- , 0x2101 // option flags, 0x2001 is what OpenOffice.org uses
- , 0 // reserved
- , 0 // reserved
- , 0 // reserved
+ pack('vvvvvVVV',
+ 0x0015, // 0x0015 = ftCmo
+ 0x0012, // length of ftCmo data
+ 0x0014, // object type, 0x0014 = filter
+ $i, // object id number, Excel seems to use 1-based index, local for the sheet
+ 0x2101, // option flags, 0x2001 is what OpenOffice.org uses
+ 0, // reserved
+ 0, // reserved
+ 0 // reserved
);
// Add ftSbs Scroll bar subobject
@@ -2780,27 +2753,26 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Add ftLbsData (List box data) subobject
$objData .= pack('vv', 0x0013, 0x1FEE);
$objData .= pack('H*', '00000000010001030000020008005700');
- }
- else {
+ } else {
// Add ftCmo (common object data) subobject
$objData .=
- pack('vvvvvVVV'
- , 0x0015 // 0x0015 = ftCmo
- , 0x0012 // length of ftCmo data
- , 0x0008 // object type, 0x0008 = picture
- , $i // object id number, Excel seems to use 1-based index, local for the sheet
- , 0x6011 // option flags, 0x6011 is what OpenOffice.org uses
- , 0 // reserved
- , 0 // reserved
- , 0 // reserved
+ pack('vvvvvVVV',
+ 0x0015, // 0x0015 = ftCmo
+ 0x0012, // length of ftCmo data
+ 0x0008, // object type, 0x0008 = picture
+ $i, // object id number, Excel seems to use 1-based index, local for the sheet
+ 0x6011, // option flags, 0x6011 is what OpenOffice.org uses
+ 0, // reserved
+ 0, // reserved
+ 0 // reserved
);
}
// ftEnd
$objData .=
- pack('vv'
- , 0x0000 // 0x0000 = ftEnd
- , 0x0000 // length of ftEnd data
+ pack('vv',
+ 0x0000, // 0x0000 = ftEnd
+ 0x0000 // length of ftEnd data
);
$length = strlen($objData);
@@ -2820,19 +2792,17 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Write data validations?
if (!empty($dataValidationCollection)) {
-
// DATAVALIDATIONS record
$record = 0x01B2; // Record identifier
- $length = 0x0012; // Bytes to follow
+ $length = 0x0012; // Bytes to follow
$grbit = 0x0000; // Prompt box at cell, no cached validity data at DV records
- $horPos = 0x00000000; // Horizontal position of prompt box, if fixed position
- $verPos = 0x00000000; // Vertical position of prompt box, if fixed position
+ $horPos = 0x00000000; // Horizontal position of prompt box, if fixed position
+ $verPos = 0x00000000; // Vertical position of prompt box, if fixed position
$objId = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible
- $header = pack('vv', $record, $length);
- $data = pack('vVVVV', $grbit, $horPos, $verPos, $objId,
- count($dataValidationCollection));
+ $header = pack('vv', $record, $length);
+ $data = pack('vVVVV', $grbit, $horPos, $verPos, $objId, count($dataValidationCollection));
$this->_append($header.$data);
// DATAVALIDATION records
@@ -2848,29 +2818,51 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// data type
$type = $dataValidation->getType();
switch ($type) {
- case PHPExcel_Cell_DataValidation::TYPE_NONE: $type = 0x00; break;
- case PHPExcel_Cell_DataValidation::TYPE_WHOLE: $type = 0x01; break;
- case PHPExcel_Cell_DataValidation::TYPE_DECIMAL: $type = 0x02; break;
- case PHPExcel_Cell_DataValidation::TYPE_LIST: $type = 0x03; break;
- case PHPExcel_Cell_DataValidation::TYPE_DATE: $type = 0x04; break;
- case PHPExcel_Cell_DataValidation::TYPE_TIME: $type = 0x05; break;
- case PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH: $type = 0x06; break;
- case PHPExcel_Cell_DataValidation::TYPE_CUSTOM: $type = 0x07; break;
+ case PHPExcel_Cell_DataValidation::TYPE_NONE:
+ $type = 0x00;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_WHOLE:
+ $type = 0x01;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_DECIMAL:
+ $type = 0x02;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_LIST:
+ $type = 0x03;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_DATE:
+ $type = 0x04;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_TIME:
+ $type = 0x05;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_TEXTLENGTH:
+ $type = 0x06;
+ break;
+ case PHPExcel_Cell_DataValidation::TYPE_CUSTOM:
+ $type = 0x07;
+ break;
}
$options |= $type << 0;
// error style
$errorStyle = $dataValidation->getType();
switch ($errorStyle) {
- case PHPExcel_Cell_DataValidation::STYLE_STOP: $errorStyle = 0x00; break;
- case PHPExcel_Cell_DataValidation::STYLE_WARNING: $errorStyle = 0x01; break;
- case PHPExcel_Cell_DataValidation::STYLE_INFORMATION: $errorStyle = 0x02; break;
+ case PHPExcel_Cell_DataValidation::STYLE_STOP:
+ $errorStyle = 0x00;
+ break;
+ case PHPExcel_Cell_DataValidation::STYLE_WARNING:
+ $errorStyle = 0x01;
+ break;
+ case PHPExcel_Cell_DataValidation::STYLE_INFORMATION:
+ $errorStyle = 0x02;
+ break;
}
$options |= $errorStyle << 4;
// explicit formula?
if ($type == 0x03 && preg_match('/^\".*\"$/', $dataValidation->getFormula1())) {
- $options |= 0x01 << 7;
+ $options |= 0x01 << 7;
}
// empty cells allowed
@@ -2888,14 +2880,30 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// condition operator
$operator = $dataValidation->getOperator();
switch ($operator) {
- case PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN: $operator = 0x00 ; break;
- case PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN: $operator = 0x01 ; break;
- case PHPExcel_Cell_DataValidation::OPERATOR_EQUAL: $operator = 0x02 ; break;
- case PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL: $operator = 0x03 ; break;
- case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN: $operator = 0x04 ; break;
- case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN: $operator = 0x05 ; break;
- case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL: $operator = 0x06; break;
- case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL: $operator = 0x07 ; break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN:
+ $operator = 0x00;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_NOTBETWEEN:
+ $operator = 0x01;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_EQUAL:
+ $operator = 0x02;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_NOTEQUAL:
+ $operator = 0x03;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHAN:
+ $operator = 0x04;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHAN:
+ $operator = 0x05;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL:
+ $operator = 0x06;
+ break;
+ case PHPExcel_Cell_DataValidation::OPERATOR_LESSTHANOREQUAL:
+ $operator = 0x07;
+ break;
}
$options |= $operator << 20;
@@ -2930,8 +2938,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$this->_parser->parse($formula1);
$formula1 = $this->_parser->toReversePolish();
$sz1 = strlen($formula1);
-
- } catch(PHPExcel_Exception $e) {
+ } catch (PHPExcel_Exception $e) {
$sz1 = 0;
$formula1 = '';
}
@@ -2947,8 +2954,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$this->_parser->parse($formula2);
$formula2 = $this->_parser->toReversePolish();
$sz2 = strlen($formula2);
-
- } catch(PHPExcel_Exception $e) {
+ } catch (PHPExcel_Exception $e) {
$sz2 = 0;
$formula2 = '';
}
@@ -2960,7 +2966,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$data .= $this->_writeBIFF8CellRangeAddressFixed($cellCoordinate);
$length = strlen($data);
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
$this->_append($header . $data);
}
@@ -2973,15 +2979,23 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* @param string $errorCode
* @return int
*/
- private static function _mapErrorCode($errorCode) {
+ private static function _mapErrorCode($errorCode)
+ {
switch ($errorCode) {
- case '#NULL!': return 0x00;
- case '#DIV/0!': return 0x07;
- case '#VALUE!': return 0x0F;
- case '#REF!': return 0x17;
- case '#NAME?': return 0x1D;
- case '#NUM!': return 0x24;
- case '#N/A': return 0x2A;
+ case '#NULL!':
+ return 0x00;
+ case '#DIV/0!':
+ return 0x07;
+ case '#VALUE!':
+ return 0x0F;
+ case '#REF!':
+ return 0x17;
+ case '#NAME?':
+ return 0x1D;
+ case '#NUM!':
+ return 0x24;
+ case '#N/A':
+ return 0x2A;
}
return 0;
@@ -2990,7 +3004,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
/**
* Write PLV Record
*/
- private function _writePageLayoutView(){
+ private function _writePageLayoutView()
+ {
$record = 0x088B; // Record identifier
$length = 0x0010; // Bytes to follow
@@ -3000,7 +3015,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$wScalvePLV = $this->_phpSheet->getSheetView()->getZoomScale(); // 2
// The options flags that comprise $grbit
- if($this->_phpSheet->getSheetView()->getView() == PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT){
+ if ($this->_phpSheet->getSheetView()->getView() == PHPExcel_Worksheet_SheetView::SHEETVIEW_PAGE_LAYOUT) {
$fPageLayoutView = 1;
} else {
$fPageLayoutView = 0;
@@ -3021,18 +3036,19 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
* Write CFRule Record
* @param PHPExcel_Style_Conditional $conditional
*/
- private function _writeCFRule(PHPExcel_Style_Conditional $conditional){
+ private function _writeCFRule(PHPExcel_Style_Conditional $conditional)
+ {
$record = 0x01B1; // Record identifier
// $type : Type of the CF
// $operatorType : Comparison operator
- if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION){
+ if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
$type = 0x02;
$operatorType = 0x00;
- } else if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){
+ } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) {
$type = 0x01;
- switch ($conditional->getOperatorType()){
+ switch ($conditional->getOperatorType()) {
case PHPExcel_Style_Conditional::OPERATOR_NONE:
$operatorType = 0x00;
break;
@@ -3065,12 +3081,12 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// $szValue2 : size of the formula data for second value or formula
$arrConditions = $conditional->getConditions();
$numConditions = sizeof($arrConditions);
- if($numConditions == 1){
+ if ($numConditions == 1) {
$szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000);
$szValue2 = 0x0000;
$operand1 = pack('Cv', 0x1E, $arrConditions[0]);
$operand2 = null;
- } else if($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)){
+ } else if ($numConditions == 2 && ($conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BETWEEN)) {
$szValue1 = ($arrConditions[0] <= 65535 ? 3 : 0x0000);
$szValue2 = ($arrConditions[1] <= 65535 ? 3 : 0x0000);
$operand1 = pack('Cv', 0x1E, $arrConditions[0]);
@@ -3090,7 +3106,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$bTxRotation = ($conditional->getStyle()->getAlignment()->getTextRotation() == null ? 1 : 0);
$bIndent = ($conditional->getStyle()->getAlignment()->getIndent() == 0 ? 1 : 0);
$bShrinkToFit = ($conditional->getStyle()->getAlignment()->getShrinkToFit() == false ? 1 : 0);
- if($bAlignHz == 0 || $bAlignVt == 0 || $bAlignWrapTx == 0 || $bTxRotation == 0 || $bIndent == 0 || $bShrinkToFit == 0){
+ if ($bAlignHz == 0 || $bAlignVt == 0 || $bAlignWrapTx == 0 || $bTxRotation == 0 || $bIndent == 0 || $bShrinkToFit == 0) {
$bFormatAlign = 1;
} else {
$bFormatAlign = 0;
@@ -3098,7 +3114,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Protection
$bProtLocked = ($conditional->getStyle()->getProtection()->getLocked() == null ? 1 : 0);
$bProtHidden = ($conditional->getStyle()->getProtection()->getHidden() == null ? 1 : 0);
- if($bProtLocked == 0 || $bProtHidden == 0){
+ if ($bProtLocked == 0 || $bProtHidden == 0) {
$bFormatProt = 1;
} else {
$bFormatProt = 0;
@@ -3112,7 +3128,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
&& $conditional->getStyle()->getBorders()->getTop()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0);
$bBorderBottom = ($conditional->getStyle()->getBorders()->getBottom()->getColor()->getARGB() == PHPExcel_Style_Color::COLOR_BLACK
&& $conditional->getStyle()->getBorders()->getBottom()->getBorderStyle() == PHPExcel_Style_Border::BORDER_NONE ? 1 : 0);
- if($bBorderLeft == 0 || $bBorderRight == 0 || $bBorderTop == 0 || $bBorderBottom == 0){
+ if ($bBorderLeft == 0 || $bBorderRight == 0 || $bBorderTop == 0 || $bBorderBottom == 0) {
$bFormatBorder = 1;
} else {
$bFormatBorder = 0;
@@ -3121,13 +3137,13 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$bFillStyle = ($conditional->getStyle()->getFill()->getFillType() == null ? 0 : 1);
$bFillColor = ($conditional->getStyle()->getFill()->getStartColor()->getARGB() == null ? 0 : 1);
$bFillColorBg = ($conditional->getStyle()->getFill()->getEndColor()->getARGB() == null ? 0 : 1);
- if($bFillStyle == 0 || $bFillColor == 0 || $bFillColorBg == 0){
+ if ($bFillStyle == 0 || $bFillColor == 0 || $bFillColorBg == 0) {
$bFormatFill = 1;
} else {
$bFormatFill = 0;
}
// Font
- if($conditional->getStyle()->getFont()->getName() != null
+ if ($conditional->getStyle()->getFont()->getName() != null
|| $conditional->getStyle()->getFont()->getSize() != null
|| $conditional->getStyle()->getFont()->getBold() != null
|| $conditional->getStyle()->getFont()->getItalic() != null
@@ -3135,7 +3151,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|| $conditional->getStyle()->getFont()->getSubScript() != null
|| $conditional->getStyle()->getFont()->getUnderline() != null
|| $conditional->getStyle()->getFont()->getStrikethrough() != null
- || $conditional->getStyle()->getFont()->getColor()->getARGB() != null){
+ || $conditional->getStyle()->getFont()->getColor()->getARGB() != null) {
$bFormatFont = 1;
} else {
$bFormatFont = 0;
@@ -3169,7 +3185,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$flags |= (1 == 1 ? 0x00380000 : 0);
// Font
$flags |= (1 == $bFormatFont ? 0x04000000 : 0);
- // Alignment :
+ // Alignment:
$flags |= (1 == $bFormatAlign ? 0x08000000 : 0);
// Border
$flags |= (1 == $bFormatBorder ? 0x10000000 : 0);
@@ -3181,16 +3197,16 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$flags |= (1 == 0 ? 0x80000000 : 0);
// Data Blocks
- if($bFormatFont == 1){
+ if ($bFormatFont == 1) {
// Font Name
- if($conditional->getStyle()->getFont()->getName() == null){
+ if ($conditional->getStyle()->getFont()->getName() == null) {
$dataBlockFont = pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
$dataBlockFont .= pack('VVVVVVVV', 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
} else {
$dataBlockFont = PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong($conditional->getStyle()->getFont()->getName());
}
// Font Size
- if($conditional->getStyle()->getFont()->getSize() == null){
+ if ($conditional->getStyle()->getFont()->getSize() == null) {
$dataBlockFont .= pack('V', 20 * 11);
} else {
$dataBlockFont .= pack('V', 20 * $conditional->getStyle()->getFont()->getSize());
@@ -3198,16 +3214,16 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Font Options
$dataBlockFont .= pack('V', 0);
// Font weight
- if($conditional->getStyle()->getFont()->getBold() == true){
+ if ($conditional->getStyle()->getFont()->getBold() == true) {
$dataBlockFont .= pack('v', 0x02BC);
} else {
$dataBlockFont .= pack('v', 0x0190);
}
// Escapement type
- if($conditional->getStyle()->getFont()->getSubScript() == true){
+ if ($conditional->getStyle()->getFont()->getSubScript() == true) {
$dataBlockFont .= pack('v', 0x02);
$fontEscapement = 0;
- } else if($conditional->getStyle()->getFont()->getSuperScript() == true){
+ } else if ($conditional->getStyle()->getFont()->getSuperScript() == true) {
$dataBlockFont .= pack('v', 0x01);
$fontEscapement = 0;
} else {
@@ -3215,75 +3231,206 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$fontEscapement = 1;
}
// Underline type
- switch ($conditional->getStyle()->getFont()->getUnderline()){
- case PHPExcel_Style_Font::UNDERLINE_NONE : $dataBlockFont .= pack('C', 0x00); $fontUnderline = 0; break;
- case PHPExcel_Style_Font::UNDERLINE_DOUBLE : $dataBlockFont .= pack('C', 0x02); $fontUnderline = 0; break;
- case PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING : $dataBlockFont .= pack('C', 0x22); $fontUnderline = 0; break;
- case PHPExcel_Style_Font::UNDERLINE_SINGLE : $dataBlockFont .= pack('C', 0x01); $fontUnderline = 0; break;
- case PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING : $dataBlockFont .= pack('C', 0x21); $fontUnderline = 0; break;
- default : $dataBlockFont .= pack('C', 0x00); $fontUnderline = 1; break;
+ switch ($conditional->getStyle()->getFont()->getUnderline()) {
+ case PHPExcel_Style_Font::UNDERLINE_NONE:
+ $dataBlockFont .= pack('C', 0x00);
+ $fontUnderline = 0;
+ break;
+ case PHPExcel_Style_Font::UNDERLINE_DOUBLE:
+ $dataBlockFont .= pack('C', 0x02);
+ $fontUnderline = 0;
+ break;
+ case PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING:
+ $dataBlockFont .= pack('C', 0x22);
+ $fontUnderline = 0;
+ break;
+ case PHPExcel_Style_Font::UNDERLINE_SINGLE:
+ $dataBlockFont .= pack('C', 0x01);
+ $fontUnderline = 0;
+ break;
+ case PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING:
+ $dataBlockFont .= pack('C', 0x21);
+ $fontUnderline = 0;
+ break;
+ default: $dataBlockFont .= pack('C', 0x00);
+ $fontUnderline = 1;
+ break;
}
// Not used (3)
$dataBlockFont .= pack('vC', 0x0000, 0x00);
// Font color index
switch ($conditional->getStyle()->getFont()->getColor()->getRGB()) {
- case '000000': $colorIdx = 0x08; break;
- case 'FFFFFF': $colorIdx = 0x09; break;
- case 'FF0000': $colorIdx = 0x0A; break;
- case '00FF00': $colorIdx = 0x0B; break;
- case '0000FF': $colorIdx = 0x0C; break;
- case 'FFFF00': $colorIdx = 0x0D; break;
- case 'FF00FF': $colorIdx = 0x0E; break;
- case '00FFFF': $colorIdx = 0x0F; break;
- case '800000': $colorIdx = 0x10; break;
- case '008000': $colorIdx = 0x11; break;
- case '000080': $colorIdx = 0x12; break;
- case '808000': $colorIdx = 0x13; break;
- case '800080': $colorIdx = 0x14; break;
- case '008080': $colorIdx = 0x15; break;
- case 'C0C0C0': $colorIdx = 0x16; break;
- case '808080': $colorIdx = 0x17; break;
- case '9999FF': $colorIdx = 0x18; break;
- case '993366': $colorIdx = 0x19; break;
- case 'FFFFCC': $colorIdx = 0x1A; break;
- case 'CCFFFF': $colorIdx = 0x1B; break;
- case '660066': $colorIdx = 0x1C; break;
- case 'FF8080': $colorIdx = 0x1D; break;
- case '0066CC': $colorIdx = 0x1E; break;
- case 'CCCCFF': $colorIdx = 0x1F; break;
- case '000080': $colorIdx = 0x20; break;
- case 'FF00FF': $colorIdx = 0x21; break;
- case 'FFFF00': $colorIdx = 0x22; break;
- case '00FFFF': $colorIdx = 0x23; break;
- case '800080': $colorIdx = 0x24; break;
- case '800000': $colorIdx = 0x25; break;
- case '008080': $colorIdx = 0x26; break;
- case '0000FF': $colorIdx = 0x27; break;
- case '00CCFF': $colorIdx = 0x28; break;
- case 'CCFFFF': $colorIdx = 0x29; break;
- case 'CCFFCC': $colorIdx = 0x2A; break;
- case 'FFFF99': $colorIdx = 0x2B; break;
- case '99CCFF': $colorIdx = 0x2C; break;
- case 'FF99CC': $colorIdx = 0x2D; break;
- case 'CC99FF': $colorIdx = 0x2E; break;
- case 'FFCC99': $colorIdx = 0x2F; break;
- case '3366FF': $colorIdx = 0x30; break;
- case '33CCCC': $colorIdx = 0x31; break;
- case '99CC00': $colorIdx = 0x32; break;
- case 'FFCC00': $colorIdx = 0x33; break;
- case 'FF9900': $colorIdx = 0x34; break;
- case 'FF6600': $colorIdx = 0x35; break;
- case '666699': $colorIdx = 0x36; break;
- case '969696': $colorIdx = 0x37; break;
- case '003366': $colorIdx = 0x38; break;
- case '339966': $colorIdx = 0x39; break;
- case '003300': $colorIdx = 0x3A; break;
- case '333300': $colorIdx = 0x3B; break;
- case '993300': $colorIdx = 0x3C; break;
- case '993366': $colorIdx = 0x3D; break;
- case '333399': $colorIdx = 0x3E; break;
- case '333333': $colorIdx = 0x3F; break;
- default: $colorIdx = 0x00; break;
+ case '000000':
+ $colorIdx = 0x08;
+ break;
+ case 'FFFFFF':
+ $colorIdx = 0x09;
+ break;
+ case 'FF0000':
+ $colorIdx = 0x0A;
+ break;
+ case '00FF00':
+ $colorIdx = 0x0B;
+ break;
+ case '0000FF':
+ $colorIdx = 0x0C;
+ break;
+ case 'FFFF00':
+ $colorIdx = 0x0D;
+ break;
+ case 'FF00FF':
+ $colorIdx = 0x0E;
+ break;
+ case '00FFFF':
+ $colorIdx = 0x0F;
+ break;
+ case '800000':
+ $colorIdx = 0x10;
+ break;
+ case '008000':
+ $colorIdx = 0x11;
+ break;
+ case '000080':
+ $colorIdx = 0x12;
+ break;
+ case '808000':
+ $colorIdx = 0x13;
+ break;
+ case '800080':
+ $colorIdx = 0x14;
+ break;
+ case '008080':
+ $colorIdx = 0x15;
+ break;
+ case 'C0C0C0':
+ $colorIdx = 0x16;
+ break;
+ case '808080':
+ $colorIdx = 0x17;
+ break;
+ case '9999FF':
+ $colorIdx = 0x18;
+ break;
+ case '993366':
+ $colorIdx = 0x19;
+ break;
+ case 'FFFFCC':
+ $colorIdx = 0x1A;
+ break;
+ case 'CCFFFF':
+ $colorIdx = 0x1B;
+ break;
+ case '660066':
+ $colorIdx = 0x1C;
+ break;
+ case 'FF8080':
+ $colorIdx = 0x1D;
+ break;
+ case '0066CC':
+ $colorIdx = 0x1E;
+ break;
+ case 'CCCCFF':
+ $colorIdx = 0x1F;
+ break;
+ case '000080':
+ $colorIdx = 0x20;
+ break;
+ case 'FF00FF':
+ $colorIdx = 0x21;
+ break;
+ case 'FFFF00':
+ $colorIdx = 0x22;
+ break;
+ case '00FFFF':
+ $colorIdx = 0x23;
+ break;
+ case '800080':
+ $colorIdx = 0x24;
+ break;
+ case '800000':
+ $colorIdx = 0x25;
+ break;
+ case '008080':
+ $colorIdx = 0x26;
+ break;
+ case '0000FF':
+ $colorIdx = 0x27;
+ break;
+ case '00CCFF':
+ $colorIdx = 0x28;
+ break;
+ case 'CCFFFF':
+ $colorIdx = 0x29;
+ break;
+ case 'CCFFCC':
+ $colorIdx = 0x2A;
+ break;
+ case 'FFFF99':
+ $colorIdx = 0x2B;
+ break;
+ case '99CCFF':
+ $colorIdx = 0x2C;
+ break;
+ case 'FF99CC':
+ $colorIdx = 0x2D;
+ break;
+ case 'CC99FF':
+ $colorIdx = 0x2E;
+ break;
+ case 'FFCC99':
+ $colorIdx = 0x2F;
+ break;
+ case '3366FF':
+ $colorIdx = 0x30;
+ break;
+ case '33CCCC':
+ $colorIdx = 0x31;
+ break;
+ case '99CC00':
+ $colorIdx = 0x32;
+ break;
+ case 'FFCC00':
+ $colorIdx = 0x33;
+ break;
+ case 'FF9900':
+ $colorIdx = 0x34;
+ break;
+ case 'FF6600':
+ $colorIdx = 0x35;
+ break;
+ case '666699':
+ $colorIdx = 0x36;
+ break;
+ case '969696':
+ $colorIdx = 0x37;
+ break;
+ case '003366':
+ $colorIdx = 0x38;
+ break;
+ case '339966':
+ $colorIdx = 0x39;
+ break;
+ case '003300':
+ $colorIdx = 0x3A;
+ break;
+ case '333300':
+ $colorIdx = 0x3B;
+ break;
+ case '993300':
+ $colorIdx = 0x3C;
+ break;
+ case '993366':
+ $colorIdx = 0x3D;
+ break;
+ case '333399':
+ $colorIdx = 0x3E;
+ break;
+ case '333333':
+ $colorIdx = 0x3F;
+ break;
+ default:
+ $colorIdx = 0x00;
+ break;
}
$dataBlockFont .= pack('V', $colorIdx);
// Not used (4)
@@ -3310,27 +3457,47 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Always
$dataBlockFont .= pack('v', 0x0001);
}
- if($bFormatAlign == 1){
+ if ($bFormatAlign == 1) {
$blockAlign = 0;
// Alignment and text break
- switch ($conditional->getStyle()->getAlignment()->getHorizontal()){
- case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL : $blockAlign = 0; break;
- case PHPExcel_Style_Alignment::HORIZONTAL_LEFT : $blockAlign = 1; break;
- case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT : $blockAlign = 3; break;
- case PHPExcel_Style_Alignment::HORIZONTAL_CENTER : $blockAlign = 2; break;
- case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS : $blockAlign = 6; break;
- case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY : $blockAlign = 5; break;
+ switch ($conditional->getStyle()->getAlignment()->getHorizontal()) {
+ case PHPExcel_Style_Alignment::HORIZONTAL_GENERAL:
+ $blockAlign = 0;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_LEFT:
+ $blockAlign = 1;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_RIGHT:
+ $blockAlign = 3;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_CENTER:
+ $blockAlign = 2;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS:
+ $blockAlign = 6;
+ break;
+ case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY:
+ $blockAlign = 5;
+ break;
}
- if($conditional->getStyle()->getAlignment()->getWrapText() == true){
+ if ($conditional->getStyle()->getAlignment()->getWrapText() == true) {
$blockAlign |= 1 << 3;
} else {
$blockAlign |= 0 << 3;
}
- switch ($conditional->getStyle()->getAlignment()->getVertical()){
- case PHPExcel_Style_Alignment::VERTICAL_BOTTOM : $blockAlign = 2 << 4; break;
- case PHPExcel_Style_Alignment::VERTICAL_TOP : $blockAlign = 0 << 4; break;
- case PHPExcel_Style_Alignment::VERTICAL_CENTER : $blockAlign = 1 << 4; break;
- case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY : $blockAlign = 3 << 4; break;
+ switch ($conditional->getStyle()->getAlignment()->getVertical()) {
+ case PHPExcel_Style_Alignment::VERTICAL_BOTTOM:
+ $blockAlign = 2 << 4;
+ break;
+ case PHPExcel_Style_Alignment::VERTICAL_TOP:
+ $blockAlign = 0 << 4;
+ break;
+ case PHPExcel_Style_Alignment::VERTICAL_CENTER:
+ $blockAlign = 1 << 4;
+ break;
+ case PHPExcel_Style_Alignment::VERTICAL_JUSTIFY:
+ $blockAlign = 3 << 4;
+ break;
}
$blockAlign |= 0 << 7;
@@ -3339,7 +3506,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// Indentation
$blockIndent = $conditional->getStyle()->getAlignment()->getIndent();
- if($conditional->getStyle()->getAlignment()->getShrinkToFit() == true){
+ if ($conditional->getStyle()->getAlignment()->getShrinkToFit() == true) {
$blockIndent |= 1 << 4;
} else {
$blockIndent |= 0 << 4;
@@ -3351,71 +3518,183 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$dataBlockAlign = pack('CCvvv', $blockAlign, $blockRotation, $blockIndent, $blockIndentRelative, 0x0000);
}
- if($bFormatBorder == 1){
+ if ($bFormatBorder == 1) {
$blockLineStyle = 0;
- switch ($conditional->getStyle()->getBorders()->getLeft()->getBorderStyle()){
- case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00; break;
- case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01; break;
- case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02; break;
- case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03; break;
- case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04; break;
- case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05; break;
- case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06; break;
- case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08; break;
- case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A; break;
- case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C; break;
- case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D; break;
+ switch ($conditional->getStyle()->getBorders()->getLeft()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockLineStyle |= 0x00;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockLineStyle |= 0x01;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockLineStyle |= 0x02;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockLineStyle |= 0x03;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockLineStyle |= 0x04;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockLineStyle |= 0x05;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockLineStyle |= 0x06;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockLineStyle |= 0x07;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockLineStyle |= 0x08;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockLineStyle |= 0x09;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockLineStyle |= 0x0A;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockLineStyle |= 0x0B;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockLineStyle |= 0x0C;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockLineStyle |= 0x0D;
+ break;
}
- switch ($conditional->getStyle()->getBorders()->getRight()->getBorderStyle()){
- case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 4; break;
- case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 4; break;
- case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 4; break;
- case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 4; break;
- case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 4; break;
- case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 4; break;
- case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 4; break;
- case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 4; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 4; break;
- case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 4; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 4; break;
- case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 4; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 4; break;
- case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 4; break;
+ switch ($conditional->getStyle()->getBorders()->getRight()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockLineStyle |= 0x00 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockLineStyle |= 0x01 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockLineStyle |= 0x02 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockLineStyle |= 0x03 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockLineStyle |= 0x04 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockLineStyle |= 0x05 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockLineStyle |= 0x06 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockLineStyle |= 0x07 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockLineStyle |= 0x08 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockLineStyle |= 0x09 << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockLineStyle |= 0x0A << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockLineStyle |= 0x0B << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockLineStyle |= 0x0C << 4;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockLineStyle |= 0x0D << 4;
+ break;
}
- switch ($conditional->getStyle()->getBorders()->getTop()->getBorderStyle()){
- case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 8; break;
- case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 8; break;
- case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 8; break;
- case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 8; break;
- case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 8; break;
- case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 8; break;
- case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 8; break;
- case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 8; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 8; break;
- case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 8; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 8; break;
- case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 8; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 8; break;
- case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 8; break;
+ switch ($conditional->getStyle()->getBorders()->getTop()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockLineStyle |= 0x00 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockLineStyle |= 0x01 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockLineStyle |= 0x02 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockLineStyle |= 0x03 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockLineStyle |= 0x04 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockLineStyle |= 0x05 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockLineStyle |= 0x06 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockLineStyle |= 0x07 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockLineStyle |= 0x08 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockLineStyle |= 0x09 << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockLineStyle |= 0x0A << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockLineStyle |= 0x0B << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockLineStyle |= 0x0C << 8;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockLineStyle |= 0x0D << 8;
+ break;
}
- switch ($conditional->getStyle()->getBorders()->getBottom()->getBorderStyle()){
- case PHPExcel_Style_Border::BORDER_NONE : $blockLineStyle |= 0x00 << 12; break;
- case PHPExcel_Style_Border::BORDER_THIN : $blockLineStyle |= 0x01 << 12; break;
- case PHPExcel_Style_Border::BORDER_MEDIUM : $blockLineStyle |= 0x02 << 12; break;
- case PHPExcel_Style_Border::BORDER_DASHED : $blockLineStyle |= 0x03 << 12; break;
- case PHPExcel_Style_Border::BORDER_DOTTED : $blockLineStyle |= 0x04 << 12; break;
- case PHPExcel_Style_Border::BORDER_THICK : $blockLineStyle |= 0x05 << 12; break;
- case PHPExcel_Style_Border::BORDER_DOUBLE : $blockLineStyle |= 0x06 << 12; break;
- case PHPExcel_Style_Border::BORDER_HAIR : $blockLineStyle |= 0x07 << 12; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockLineStyle |= 0x08 << 12; break;
- case PHPExcel_Style_Border::BORDER_DASHDOT : $blockLineStyle |= 0x09 << 12; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockLineStyle |= 0x0A << 12; break;
- case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockLineStyle |= 0x0B << 12; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockLineStyle |= 0x0C << 12; break;
- case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockLineStyle |= 0x0D << 12; break;
+ switch ($conditional->getStyle()->getBorders()->getBottom()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockLineStyle |= 0x00 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockLineStyle |= 0x01 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockLineStyle |= 0x02 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockLineStyle |= 0x03 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockLineStyle |= 0x04 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockLineStyle |= 0x05 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockLineStyle |= 0x06 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockLineStyle |= 0x07 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockLineStyle |= 0x08 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockLineStyle |= 0x09 << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockLineStyle |= 0x0A << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockLineStyle |= 0x0B << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockLineStyle |= 0x0C << 12;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockLineStyle |= 0x0D << 12;
+ break;
}
//@todo _writeCFRule() => $blockLineStyle => Index Color for left line
//@todo _writeCFRule() => $blockLineStyle => Index Color for right line
@@ -3425,204 +3704,504 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
//@todo _writeCFRule() => $blockColor => Index Color for top line
//@todo _writeCFRule() => $blockColor => Index Color for bottom line
//@todo _writeCFRule() => $blockColor => Index Color for diagonal line
- switch ($conditional->getStyle()->getBorders()->getDiagonal()->getBorderStyle()){
- case PHPExcel_Style_Border::BORDER_NONE : $blockColor |= 0x00 << 21; break;
- case PHPExcel_Style_Border::BORDER_THIN : $blockColor |= 0x01 << 21; break;
- case PHPExcel_Style_Border::BORDER_MEDIUM : $blockColor |= 0x02 << 21; break;
- case PHPExcel_Style_Border::BORDER_DASHED : $blockColor |= 0x03 << 21; break;
- case PHPExcel_Style_Border::BORDER_DOTTED : $blockColor |= 0x04 << 21; break;
- case PHPExcel_Style_Border::BORDER_THICK : $blockColor |= 0x05 << 21; break;
- case PHPExcel_Style_Border::BORDER_DOUBLE : $blockColor |= 0x06 << 21; break;
- case PHPExcel_Style_Border::BORDER_HAIR : $blockColor |= 0x07 << 21; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHED : $blockColor |= 0x08 << 21; break;
- case PHPExcel_Style_Border::BORDER_DASHDOT : $blockColor |= 0x09 << 21; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT : $blockColor |= 0x0A << 21; break;
- case PHPExcel_Style_Border::BORDER_DASHDOTDOT : $blockColor |= 0x0B << 21; break;
- case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT : $blockColor |= 0x0C << 21; break;
- case PHPExcel_Style_Border::BORDER_SLANTDASHDOT : $blockColor |= 0x0D << 21; break;
+ switch ($conditional->getStyle()->getBorders()->getDiagonal()->getBorderStyle()) {
+ case PHPExcel_Style_Border::BORDER_NONE:
+ $blockColor |= 0x00 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_THIN:
+ $blockColor |= 0x01 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUM:
+ $blockColor |= 0x02 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHED:
+ $blockColor |= 0x03 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOTTED:
+ $blockColor |= 0x04 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_THICK:
+ $blockColor |= 0x05 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DOUBLE:
+ $blockColor |= 0x06 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_HAIR:
+ $blockColor |= 0x07 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHED:
+ $blockColor |= 0x08 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOT:
+ $blockColor |= 0x09 << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT:
+ $blockColor |= 0x0A << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_DASHDOTDOT:
+ $blockColor |= 0x0B << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT:
+ $blockColor |= 0x0C << 21;
+ break;
+ case PHPExcel_Style_Border::BORDER_SLANTDASHDOT:
+ $blockColor |= 0x0D << 21;
+ break;
}
$dataBlockBorder = pack('vv', $blockLineStyle, $blockColor);
}
- if($bFormatFill == 1){
+ if ($bFormatFill == 1) {
// Fill Patern Style
$blockFillPatternStyle = 0;
- switch ($conditional->getStyle()->getFill()->getFillType()){
- case PHPExcel_Style_Fill::FILL_NONE : $blockFillPatternStyle = 0x00; break;
- case PHPExcel_Style_Fill::FILL_SOLID : $blockFillPatternStyle = 0x01; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY : $blockFillPatternStyle = 0x02; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY : $blockFillPatternStyle = 0x03; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY : $blockFillPatternStyle = 0x04; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL : $blockFillPatternStyle = 0x05; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL : $blockFillPatternStyle = 0x06; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN : $blockFillPatternStyle = 0x07; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_DARKUP : $blockFillPatternStyle = 0x08; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID : $blockFillPatternStyle = 0x09; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS : $blockFillPatternStyle = 0x0A; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL : $blockFillPatternStyle = 0x0B; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL : $blockFillPatternStyle = 0x0C; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN : $blockFillPatternStyle = 0x0D; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP : $blockFillPatternStyle = 0x0E; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID : $blockFillPatternStyle = 0x0F; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS : $blockFillPatternStyle = 0x10; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_GRAY125 : $blockFillPatternStyle = 0x11; break;
- case PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625 : $blockFillPatternStyle = 0x12; break;
- case PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR : $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8
- case PHPExcel_Style_Fill::FILL_GRADIENT_PATH : $blockFillPatternStyle = 0x00; break; // does not exist in BIFF8
- default : $blockFillPatternStyle = 0x00; break;
+ switch ($conditional->getStyle()->getFill()->getFillType()) {
+ case PHPExcel_Style_Fill::FILL_NONE:
+ $blockFillPatternStyle = 0x00;
+ break;
+ case PHPExcel_Style_Fill::FILL_SOLID:
+ $blockFillPatternStyle = 0x01;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY:
+ $blockFillPatternStyle = 0x02;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY:
+ $blockFillPatternStyle = 0x03;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY:
+ $blockFillPatternStyle = 0x04;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL:
+ $blockFillPatternStyle = 0x05;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL:
+ $blockFillPatternStyle = 0x06;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN:
+ $blockFillPatternStyle = 0x07;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKUP:
+ $blockFillPatternStyle = 0x08;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID:
+ $blockFillPatternStyle = 0x09;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS:
+ $blockFillPatternStyle = 0x0A;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL:
+ $blockFillPatternStyle = 0x0B;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL:
+ $blockFillPatternStyle = 0x0C;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN:
+ $blockFillPatternStyle = 0x0D;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP:
+ $blockFillPatternStyle = 0x0E;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID:
+ $blockFillPatternStyle = 0x0F;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS:
+ $blockFillPatternStyle = 0x10;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_GRAY125:
+ $blockFillPatternStyle = 0x11;
+ break;
+ case PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625:
+ $blockFillPatternStyle = 0x12;
+ break;
+ case PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR:
+ $blockFillPatternStyle = 0x00;
+ break; // does not exist in BIFF8
+ case PHPExcel_Style_Fill::FILL_GRADIENT_PATH:
+ $blockFillPatternStyle = 0x00;
+ break; // does not exist in BIFF8
+ default:
+ $blockFillPatternStyle = 0x00;
+ break;
}
// Color
switch ($conditional->getStyle()->getFill()->getStartColor()->getRGB()) {
- case '000000': $colorIdxBg = 0x08; break;
- case 'FFFFFF': $colorIdxBg = 0x09; break;
- case 'FF0000': $colorIdxBg = 0x0A; break;
- case '00FF00': $colorIdxBg = 0x0B; break;
- case '0000FF': $colorIdxBg = 0x0C; break;
- case 'FFFF00': $colorIdxBg = 0x0D; break;
- case 'FF00FF': $colorIdxBg = 0x0E; break;
- case '00FFFF': $colorIdxBg = 0x0F; break;
- case '800000': $colorIdxBg = 0x10; break;
- case '008000': $colorIdxBg = 0x11; break;
- case '000080': $colorIdxBg = 0x12; break;
- case '808000': $colorIdxBg = 0x13; break;
- case '800080': $colorIdxBg = 0x14; break;
- case '008080': $colorIdxBg = 0x15; break;
- case 'C0C0C0': $colorIdxBg = 0x16; break;
- case '808080': $colorIdxBg = 0x17; break;
- case '9999FF': $colorIdxBg = 0x18; break;
- case '993366': $colorIdxBg = 0x19; break;
- case 'FFFFCC': $colorIdxBg = 0x1A; break;
- case 'CCFFFF': $colorIdxBg = 0x1B; break;
- case '660066': $colorIdxBg = 0x1C; break;
- case 'FF8080': $colorIdxBg = 0x1D; break;
- case '0066CC': $colorIdxBg = 0x1E; break;
- case 'CCCCFF': $colorIdxBg = 0x1F; break;
- case '000080': $colorIdxBg = 0x20; break;
- case 'FF00FF': $colorIdxBg = 0x21; break;
- case 'FFFF00': $colorIdxBg = 0x22; break;
- case '00FFFF': $colorIdxBg = 0x23; break;
- case '800080': $colorIdxBg = 0x24; break;
- case '800000': $colorIdxBg = 0x25; break;
- case '008080': $colorIdxBg = 0x26; break;
- case '0000FF': $colorIdxBg = 0x27; break;
- case '00CCFF': $colorIdxBg = 0x28; break;
- case 'CCFFFF': $colorIdxBg = 0x29; break;
- case 'CCFFCC': $colorIdxBg = 0x2A; break;
- case 'FFFF99': $colorIdxBg = 0x2B; break;
- case '99CCFF': $colorIdxBg = 0x2C; break;
- case 'FF99CC': $colorIdxBg = 0x2D; break;
- case 'CC99FF': $colorIdxBg = 0x2E; break;
- case 'FFCC99': $colorIdxBg = 0x2F; break;
- case '3366FF': $colorIdxBg = 0x30; break;
- case '33CCCC': $colorIdxBg = 0x31; break;
- case '99CC00': $colorIdxBg = 0x32; break;
- case 'FFCC00': $colorIdxBg = 0x33; break;
- case 'FF9900': $colorIdxBg = 0x34; break;
- case 'FF6600': $colorIdxBg = 0x35; break;
- case '666699': $colorIdxBg = 0x36; break;
- case '969696': $colorIdxBg = 0x37; break;
- case '003366': $colorIdxBg = 0x38; break;
- case '339966': $colorIdxBg = 0x39; break;
- case '003300': $colorIdxBg = 0x3A; break;
- case '333300': $colorIdxBg = 0x3B; break;
- case '993300': $colorIdxBg = 0x3C; break;
- case '993366': $colorIdxBg = 0x3D; break;
- case '333399': $colorIdxBg = 0x3E; break;
- case '333333': $colorIdxBg = 0x3F; break;
- default: $colorIdxBg = 0x41; break;
+ case '000000':
+ $colorIdxBg = 0x08;
+ break;
+ case 'FFFFFF':
+ $colorIdxBg = 0x09;
+ break;
+ case 'FF0000':
+ $colorIdxBg = 0x0A;
+ break;
+ case '00FF00':
+ $colorIdxBg = 0x0B;
+ break;
+ case '0000FF':
+ $colorIdxBg = 0x0C;
+ break;
+ case 'FFFF00':
+ $colorIdxBg = 0x0D;
+ break;
+ case 'FF00FF':
+ $colorIdxBg = 0x0E;
+ break;
+ case '00FFFF':
+ $colorIdxBg = 0x0F;
+ break;
+ case '800000':
+ $colorIdxBg = 0x10;
+ break;
+ case '008000':
+ $colorIdxBg = 0x11;
+ break;
+ case '000080':
+ $colorIdxBg = 0x12;
+ break;
+ case '808000':
+ $colorIdxBg = 0x13;
+ break;
+ case '800080':
+ $colorIdxBg = 0x14;
+ break;
+ case '008080':
+ $colorIdxBg = 0x15;
+ break;
+ case 'C0C0C0':
+ $colorIdxBg = 0x16;
+ break;
+ case '808080':
+ $colorIdxBg = 0x17;
+ break;
+ case '9999FF':
+ $colorIdxBg = 0x18;
+ break;
+ case '993366':
+ $colorIdxBg = 0x19;
+ break;
+ case 'FFFFCC':
+ $colorIdxBg = 0x1A;
+ break;
+ case 'CCFFFF':
+ $colorIdxBg = 0x1B;
+ break;
+ case '660066':
+ $colorIdxBg = 0x1C;
+ break;
+ case 'FF8080':
+ $colorIdxBg = 0x1D;
+ break;
+ case '0066CC':
+ $colorIdxBg = 0x1E;
+ break;
+ case 'CCCCFF':
+ $colorIdxBg = 0x1F;
+ break;
+ case '000080':
+ $colorIdxBg = 0x20;
+ break;
+ case 'FF00FF':
+ $colorIdxBg = 0x21;
+ break;
+ case 'FFFF00':
+ $colorIdxBg = 0x22;
+ break;
+ case '00FFFF':
+ $colorIdxBg = 0x23;
+ break;
+ case '800080':
+ $colorIdxBg = 0x24;
+ break;
+ case '800000':
+ $colorIdxBg = 0x25;
+ break;
+ case '008080':
+ $colorIdxBg = 0x26;
+ break;
+ case '0000FF':
+ $colorIdxBg = 0x27;
+ break;
+ case '00CCFF':
+ $colorIdxBg = 0x28;
+ break;
+ case 'CCFFFF':
+ $colorIdxBg = 0x29;
+ break;
+ case 'CCFFCC':
+ $colorIdxBg = 0x2A;
+ break;
+ case 'FFFF99':
+ $colorIdxBg = 0x2B;
+ break;
+ case '99CCFF':
+ $colorIdxBg = 0x2C;
+ break;
+ case 'FF99CC':
+ $colorIdxBg = 0x2D;
+ break;
+ case 'CC99FF':
+ $colorIdxBg = 0x2E;
+ break;
+ case 'FFCC99':
+ $colorIdxBg = 0x2F;
+ break;
+ case '3366FF':
+ $colorIdxBg = 0x30;
+ break;
+ case '33CCCC':
+ $colorIdxBg = 0x31;
+ break;
+ case '99CC00':
+ $colorIdxBg = 0x32;
+ break;
+ case 'FFCC00':
+ $colorIdxBg = 0x33;
+ break;
+ case 'FF9900':
+ $colorIdxBg = 0x34;
+ break;
+ case 'FF6600':
+ $colorIdxBg = 0x35;
+ break;
+ case '666699':
+ $colorIdxBg = 0x36;
+ break;
+ case '969696':
+ $colorIdxBg = 0x37;
+ break;
+ case '003366':
+ $colorIdxBg = 0x38;
+ break;
+ case '339966':
+ $colorIdxBg = 0x39;
+ break;
+ case '003300':
+ $colorIdxBg = 0x3A;
+ break;
+ case '333300':
+ $colorIdxBg = 0x3B;
+ break;
+ case '993300':
+ $colorIdxBg = 0x3C;
+ break;
+ case '993366':
+ $colorIdxBg = 0x3D;
+ break;
+ case '333399':
+ $colorIdxBg = 0x3E;
+ break;
+ case '333333':
+ $colorIdxBg = 0x3F;
+ break;
+ default:
+ $colorIdxBg = 0x41;
+ break;
}
// Fg Color
switch ($conditional->getStyle()->getFill()->getEndColor()->getRGB()) {
- case '000000': $colorIdxFg = 0x08; break;
- case 'FFFFFF': $colorIdxFg = 0x09; break;
- case 'FF0000': $colorIdxFg = 0x0A; break;
- case '00FF00': $colorIdxFg = 0x0B; break;
- case '0000FF': $colorIdxFg = 0x0C; break;
- case 'FFFF00': $colorIdxFg = 0x0D; break;
- case 'FF00FF': $colorIdxFg = 0x0E; break;
- case '00FFFF': $colorIdxFg = 0x0F; break;
- case '800000': $colorIdxFg = 0x10; break;
- case '008000': $colorIdxFg = 0x11; break;
- case '000080': $colorIdxFg = 0x12; break;
- case '808000': $colorIdxFg = 0x13; break;
- case '800080': $colorIdxFg = 0x14; break;
- case '008080': $colorIdxFg = 0x15; break;
- case 'C0C0C0': $colorIdxFg = 0x16; break;
- case '808080': $colorIdxFg = 0x17; break;
- case '9999FF': $colorIdxFg = 0x18; break;
- case '993366': $colorIdxFg = 0x19; break;
- case 'FFFFCC': $colorIdxFg = 0x1A; break;
- case 'CCFFFF': $colorIdxFg = 0x1B; break;
- case '660066': $colorIdxFg = 0x1C; break;
- case 'FF8080': $colorIdxFg = 0x1D; break;
- case '0066CC': $colorIdxFg = 0x1E; break;
- case 'CCCCFF': $colorIdxFg = 0x1F; break;
- case '000080': $colorIdxFg = 0x20; break;
- case 'FF00FF': $colorIdxFg = 0x21; break;
- case 'FFFF00': $colorIdxFg = 0x22; break;
- case '00FFFF': $colorIdxFg = 0x23; break;
- case '800080': $colorIdxFg = 0x24; break;
- case '800000': $colorIdxFg = 0x25; break;
- case '008080': $colorIdxFg = 0x26; break;
- case '0000FF': $colorIdxFg = 0x27; break;
- case '00CCFF': $colorIdxFg = 0x28; break;
- case 'CCFFFF': $colorIdxFg = 0x29; break;
- case 'CCFFCC': $colorIdxFg = 0x2A; break;
- case 'FFFF99': $colorIdxFg = 0x2B; break;
- case '99CCFF': $colorIdxFg = 0x2C; break;
- case 'FF99CC': $colorIdxFg = 0x2D; break;
- case 'CC99FF': $colorIdxFg = 0x2E; break;
- case 'FFCC99': $colorIdxFg = 0x2F; break;
- case '3366FF': $colorIdxFg = 0x30; break;
- case '33CCCC': $colorIdxFg = 0x31; break;
- case '99CC00': $colorIdxFg = 0x32; break;
- case 'FFCC00': $colorIdxFg = 0x33; break;
- case 'FF9900': $colorIdxFg = 0x34; break;
- case 'FF6600': $colorIdxFg = 0x35; break;
- case '666699': $colorIdxFg = 0x36; break;
- case '969696': $colorIdxFg = 0x37; break;
- case '003366': $colorIdxFg = 0x38; break;
- case '339966': $colorIdxFg = 0x39; break;
- case '003300': $colorIdxFg = 0x3A; break;
- case '333300': $colorIdxFg = 0x3B; break;
- case '993300': $colorIdxFg = 0x3C; break;
- case '993366': $colorIdxFg = 0x3D; break;
- case '333399': $colorIdxFg = 0x3E; break;
- case '333333': $colorIdxFg = 0x3F; break;
- default: $colorIdxFg = 0x40; break;
+ case '000000':
+ $colorIdxFg = 0x08;
+ break;
+ case 'FFFFFF':
+ $colorIdxFg = 0x09;
+ break;
+ case 'FF0000':
+ $colorIdxFg = 0x0A;
+ break;
+ case '00FF00':
+ $colorIdxFg = 0x0B;
+ break;
+ case '0000FF':
+ $colorIdxFg = 0x0C;
+ break;
+ case 'FFFF00':
+ $colorIdxFg = 0x0D;
+ break;
+ case 'FF00FF':
+ $colorIdxFg = 0x0E;
+ break;
+ case '00FFFF':
+ $colorIdxFg = 0x0F;
+ break;
+ case '800000':
+ $colorIdxFg = 0x10;
+ break;
+ case '008000':
+ $colorIdxFg = 0x11;
+ break;
+ case '000080':
+ $colorIdxFg = 0x12;
+ break;
+ case '808000':
+ $colorIdxFg = 0x13;
+ break;
+ case '800080':
+ $colorIdxFg = 0x14;
+ break;
+ case '008080':
+ $colorIdxFg = 0x15;
+ break;
+ case 'C0C0C0':
+ $colorIdxFg = 0x16;
+ break;
+ case '808080':
+ $colorIdxFg = 0x17;
+ break;
+ case '9999FF':
+ $colorIdxFg = 0x18;
+ break;
+ case '993366':
+ $colorIdxFg = 0x19;
+ break;
+ case 'FFFFCC':
+ $colorIdxFg = 0x1A;
+ break;
+ case 'CCFFFF':
+ $colorIdxFg = 0x1B;
+ break;
+ case '660066':
+ $colorIdxFg = 0x1C;
+ break;
+ case 'FF8080':
+ $colorIdxFg = 0x1D;
+ break;
+ case '0066CC':
+ $colorIdxFg = 0x1E;
+ break;
+ case 'CCCCFF':
+ $colorIdxFg = 0x1F;
+ break;
+ case '000080':
+ $colorIdxFg = 0x20;
+ break;
+ case 'FF00FF':
+ $colorIdxFg = 0x21;
+ break;
+ case 'FFFF00':
+ $colorIdxFg = 0x22;
+ break;
+ case '00FFFF':
+ $colorIdxFg = 0x23;
+ break;
+ case '800080':
+ $colorIdxFg = 0x24;
+ break;
+ case '800000':
+ $colorIdxFg = 0x25;
+ break;
+ case '008080':
+ $colorIdxFg = 0x26;
+ break;
+ case '0000FF':
+ $colorIdxFg = 0x27;
+ break;
+ case '00CCFF':
+ $colorIdxFg = 0x28;
+ break;
+ case 'CCFFFF':
+ $colorIdxFg = 0x29;
+ break;
+ case 'CCFFCC':
+ $colorIdxFg = 0x2A;
+ break;
+ case 'FFFF99':
+ $colorIdxFg = 0x2B;
+ break;
+ case '99CCFF':
+ $colorIdxFg = 0x2C;
+ break;
+ case 'FF99CC':
+ $colorIdxFg = 0x2D;
+ break;
+ case 'CC99FF':
+ $colorIdxFg = 0x2E;
+ break;
+ case 'FFCC99':
+ $colorIdxFg = 0x2F;
+ break;
+ case '3366FF':
+ $colorIdxFg = 0x30;
+ break;
+ case '33CCCC':
+ $colorIdxFg = 0x31;
+ break;
+ case '99CC00':
+ $colorIdxFg = 0x32;
+ break;
+ case 'FFCC00':
+ $colorIdxFg = 0x33;
+ break;
+ case 'FF9900':
+ $colorIdxFg = 0x34;
+ break;
+ case 'FF6600':
+ $colorIdxFg = 0x35;
+ break;
+ case '666699':
+ $colorIdxFg = 0x36;
+ break;
+ case '969696':
+ $colorIdxFg = 0x37;
+ break;
+ case '003366':
+ $colorIdxFg = 0x38;
+ break;
+ case '339966':
+ $colorIdxFg = 0x39;
+ break;
+ case '003300':
+ $colorIdxFg = 0x3A;
+ break;
+ case '333300':
+ $colorIdxFg = 0x3B;
+ break;
+ case '993300':
+ $colorIdxFg = 0x3C;
+ break;
+ case '993366':
+ $colorIdxFg = 0x3D;
+ break;
+ case '333399':
+ $colorIdxFg = 0x3E;
+ break;
+ case '333333':
+ $colorIdxFg = 0x3F;
+ break;
+ default:
+ $colorIdxFg = 0x40;
+ break;
}
$dataBlockFill = pack('v', $blockFillPatternStyle);
$dataBlockFill .= pack('v', $colorIdxFg | ($colorIdxBg << 7));
}
- if($bFormatProt == 1){
+ if ($bFormatProt == 1) {
$dataBlockProtection = 0;
- if($conditional->getStyle()->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED){
+ if ($conditional->getStyle()->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED) {
$dataBlockProtection = 1;
}
- if($conditional->getStyle()->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED){
+ if ($conditional->getStyle()->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED) {
$dataBlockProtection = 1 << 1;
}
}
$data = pack('CCvvVv', $type, $operatorType, $szValue1, $szValue2, $flags, 0x0000);
- if($bFormatFont == 1){ // Block Formatting : OK
+ if ($bFormatFont == 1) { // Block Formatting : OK
$data .= $dataBlockFont;
}
- if($bFormatAlign == 1){
+ if ($bFormatAlign == 1) {
$data .= $dataBlockAlign;
}
- if($bFormatBorder == 1){
+ if ($bFormatBorder == 1) {
$data .= $dataBlockBorder;
}
- if($bFormatFill == 1){ // Block Formatting : OK
+ if ($bFormatFill == 1) { // Block Formatting : OK
$data .= $dataBlockFill;
}
- if($bFormatProt == 1){
+ if ($bFormatProt == 1) {
$data .= $dataBlockProtection;
}
- if(!is_null($operand1)){
+ if (!is_null($operand1)) {
$data .= $operand1;
}
- if(!is_null($operand2)){
+ if (!is_null($operand2)) {
$data .= $operand2;
}
$header = pack('vv', $record, strlen($data));
@@ -3632,7 +4211,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
/**
* Write CFHeader record
*/
- private function _writeCFHeader(){
+ private function _writeCFHeader()
+ {
$record = 0x01B0; // Record identifier
$length = 0x0016; // Bytes to follow
@@ -3643,26 +4223,26 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$arrConditional = array();
foreach ($this->_phpSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) {
foreach ($conditionalStyles as $conditional) {
- if($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
- || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS){
- if(!in_array($conditional->getHashCode(), $arrConditional)){
+ if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
+ || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS) {
+ if (!in_array($conditional->getHashCode(), $arrConditional)) {
$arrConditional[] = $conditional->getHashCode();
}
// Cells
$arrCoord = PHPExcel_Cell::coordinateFromString($cellCoordinate);
- if(!is_numeric($arrCoord[0])){
+ if (!is_numeric($arrCoord[0])) {
$arrCoord[0] = PHPExcel_Cell::columnIndexFromString($arrCoord[0]);
}
- if(is_null($numColumnMin) || ($numColumnMin > $arrCoord[0])){
+ if (is_null($numColumnMin) || ($numColumnMin > $arrCoord[0])) {
$numColumnMin = $arrCoord[0];
}
- if(is_null($numColumnMax) || ($numColumnMax < $arrCoord[0])){
+ if (is_null($numColumnMax) || ($numColumnMax < $arrCoord[0])) {
$numColumnMax = $arrCoord[0];
}
- if(is_null($numRowMin) || ($numRowMin > $arrCoord[1])){
+ if (is_null($numRowMin) || ($numRowMin > $arrCoord[1])) {
$numRowMin = $arrCoord[1];
}
- if(is_null($numRowMax) || ($numRowMax < $arrCoord[1])){
+ if (is_null($numRowMax) || ($numRowMax < $arrCoord[1])) {
$numRowMax = $arrCoord[1];
}
}
@@ -3678,4 +4258,4 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
$data .= $cellRange;
$this->_append($header . $data);
}
-}
\ No newline at end of file
+}
diff --git a/Classes/PHPExcel/Writer/Excel5/Xf.php b/Classes/PHPExcel/Writer/Excel5/Xf.php
index 7347aabb..dc185f00 100644
--- a/Classes/PHPExcel/Writer/Excel5/Xf.php
+++ b/Classes/PHPExcel/Writer/Excel5/Xf.php
@@ -166,7 +166,7 @@ class PHPExcel_Writer_Excel5_Xf
*
* @return string The XF record
*/
- function writeXf()
+ public function writeXf()
{
// Set the type of the XF record and some of the attributes.
if ($this->_isStyleXf) {
@@ -249,18 +249,14 @@ class PHPExcel_Writer_Excel5_Xf
$border2 |= self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21;
$border2 |= self::_mapFillType($this->_style->getFill()->getFillType()) << 26;
- $header = pack("vv", $record, $length);
+ $header = pack("vv", $record, $length);
//BIFF8 options: identation, shrinkToFit and text direction
$biff8_options = $this->_style->getAlignment()->getIndent();
$biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4;
$data = pack("vvvC", $ifnt, $ifmt, $style, $align);
- $data .= pack("CCC"
- , self::_mapTextRotation($this->_style->getAlignment()->getTextRotation())
- , $biff8_options
- , $used_attrib
- );
+ $data .= pack("CCC", self::_mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib);
$data .= pack("VVv", $border1, $border2, $icv);
return($header . $data);
@@ -282,7 +278,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
- function setBottomColor($colorIndex)
+ public function setBottomColor($colorIndex)
{
$this->_bottom_color = $colorIndex;
}
@@ -293,7 +289,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
- function setTopColor($colorIndex)
+ public function setTopColor($colorIndex)
{
$this->_top_color = $colorIndex;
}
@@ -304,7 +300,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
- function setLeftColor($colorIndex)
+ public function setLeftColor($colorIndex)
{
$this->_left_color = $colorIndex;
}
@@ -315,7 +311,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
- function setRightColor($colorIndex)
+ public function setRightColor($colorIndex)
{
$this->_right_color = $colorIndex;
}
@@ -326,7 +322,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
- function setDiagColor($colorIndex)
+ public function setDiagColor($colorIndex)
{
$this->_diag_color = $colorIndex;
}
@@ -338,7 +334,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
- function setFgColor($colorIndex)
+ public function setFgColor($colorIndex)
{
$this->_fg_color = $colorIndex;
}
@@ -349,7 +345,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param int $colorIndex Color index
*/
- function setBgColor($colorIndex)
+ public function setBgColor($colorIndex)
{
$this->_bg_color = $colorIndex;
}
@@ -361,7 +357,7 @@ class PHPExcel_Writer_Excel5_Xf
* @access public
* @param integer $numberFormatIndex Index to format record
*/
- function setNumberFormatIndex($numberFormatIndex)
+ public function setNumberFormatIndex($numberFormatIndex)
{
$this->_numberFormatIndex = $numberFormatIndex;
}
@@ -403,9 +399,11 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $borderStyle
* @return int
*/
- private static function _mapBorderStyle($borderStyle) {
- if (isset(self::$_mapBorderStyle[$borderStyle]))
+ private static function _mapBorderStyle($borderStyle)
+ {
+ if (isset(self::$_mapBorderStyle[$borderStyle])) {
return self::$_mapBorderStyle[$borderStyle];
+ }
return 0x00;
}
@@ -442,9 +440,11 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $fillType
* @return int
*/
- private static function _mapFillType($fillType) {
- if (isset(self::$_mapFillType[$fillType]))
+ private static function _mapFillType($fillType)
+ {
+ if (isset(self::$_mapFillType[$fillType])) {
return self::$_mapFillType[$fillType];
+ }
return 0x00;
}
@@ -469,8 +469,9 @@ class PHPExcel_Writer_Excel5_Xf
*/
private function _mapHAlign($hAlign)
{
- if (isset(self::$_mapHAlign[$hAlign]))
+ if (isset(self::$_mapHAlign[$hAlign])) {
return self::$_mapHAlign[$hAlign];
+ }
return 0;
}
@@ -490,9 +491,11 @@ class PHPExcel_Writer_Excel5_Xf
* @param string $vAlign
* @return int
*/
- private static function _mapVAlign($vAlign) {
- if (isset(self::$_mapVAlign[$vAlign]))
+ private static function _mapVAlign($vAlign)
+ {
+ if (isset(self::$_mapVAlign[$vAlign])) {
return self::$_mapVAlign[$vAlign];
+ }
return 2;
}
@@ -502,7 +505,8 @@ class PHPExcel_Writer_Excel5_Xf
* @param int $textRotation
* @return int
*/
- private static function _mapTextRotation($textRotation) {
+ private static function _mapTextRotation($textRotation)
+ {
if ($textRotation >= 0) {
return $textRotation;
}
@@ -520,12 +524,17 @@ class PHPExcel_Writer_Excel5_Xf
* @param string
* @return int
*/
- private static function _mapLocked($locked) {
+ private static function _mapLocked($locked)
+ {
switch ($locked) {
- case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 1;
- case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1;
- case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0;
- default: return 1;
+ case PHPExcel_Style_Protection::PROTECTION_INHERIT:
+ return 1;
+ case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
+ return 1;
+ case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED:
+ return 0;
+ default:
+ return 1;
}
}
@@ -535,13 +544,17 @@ class PHPExcel_Writer_Excel5_Xf
* @param string
* @return int
*/
- private static function _mapHidden($hidden) {
+ private static function _mapHidden($hidden)
+ {
switch ($hidden) {
- case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 0;
- case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1;
- case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0;
- default: return 0;
+ case PHPExcel_Style_Protection::PROTECTION_INHERIT:
+ return 0;
+ case PHPExcel_Style_Protection::PROTECTION_PROTECTED:
+ return 1;
+ case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED:
+ return 0;
+ default:
+ return 0;
}
}
-
}
diff --git a/Classes/PHPExcel/Writer/HTML.php b/Classes/PHPExcel/Writer/HTML.php
index 99a68630..eecc6ec6 100644
--- a/Classes/PHPExcel/Writer/HTML.php
+++ b/Classes/PHPExcel/Writer/HTML.php
@@ -944,7 +944,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
$css['vertical-align'] = $this->_mapVAlign($pStyle->getVertical());
if ($textAlign = $this->_mapHAlign($pStyle->getHorizontal())) {
$css['text-align'] = $textAlign;
- if (in_array($textAlign,array('left','right'))) {
+ if (in_array($textAlign, array('left', 'right'))) {
$css['padding-'.$textAlign] = (string)((int)$pStyle->getIndent() * 9).'px';
}
}
@@ -1015,7 +1015,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
{
// Create CSS
// $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
- // Create CSS - add !important to non-none border styles for merged cells
+ // Create CSS - add !important to non-none border styles for merged cells
$borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle());
$css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important');
@@ -1265,10 +1265,9 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
}
// General horizontal alignment: Actual horizontal alignment depends on dataType
- $sharedStyle = $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() );
+ $sharedStyle = $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex());
if ($sharedStyle->getAlignment()->getHorizontal() == PHPExcel_Style_Alignment::HORIZONTAL_GENERAL
- && isset($this->_cssStyles['.' . $cell->getDataType()]['text-align']))
- {
+ && isset($this->_cssStyles['.' . $cell->getDataType()]['text-align'])) {
$cssClass['text-align'] = $this->_cssStyles['.' . $cell->getDataType()]['text-align'];
}
}
@@ -1303,39 +1302,39 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
if ($writeCell) {
// Column start
$html .= ' <' . $cellType;
- if (!$this->_useInlineCss) {
- $html .= ' class="' . $cssClass . '"';
- } else {
- //** Necessary redundant code for the sake of PHPExcel_Writer_PDF **
- // We must explicitly write the width of the
* $objDrawing->setResizeProportional(true);
* $objDrawing->setWidthAndHeight(160,120);
- *
- *
+ * element because TCPDF
- // does not recognize e.g. element because TCPDF
+ // does not recognize e.g. element because TCPDF
- // does not recognize e.g.
- if (isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'])) {
- $height = $this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'];
- $cssClass['height'] = $height;
- }
- //** end of redundant code **
+ // We must also explicitly write the height of the element because TCPDF
+ // does not recognize e.g.
+ if (isset($this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'])) {
+ $height = $this->_cssStyles['table.sheet' . $sheetIndex . ' tr.row' . $pRow]['height'];
+ $cssClass['height'] = $height;
+ }
+ //** end of redundant code **
- $html .= ' style="' . $this->_assembleCSS($cssClass) . '"';
- }
- if ($colSpan > 1) {
- $html .= ' colspan="' . $colSpan . '"';
- }
- if ($rowSpan > 1) {
- $html .= ' rowspan="' . $rowSpan . '"';
- }
- $html .= '>';
+ $html .= ' style="' . $this->_assembleCSS($cssClass) . '"';
+ }
+ if ($colSpan > 1) {
+ $html .= ' colspan="' . $colSpan . '"';
+ }
+ if ($rowSpan > 1) {
+ $html .= ' rowspan="' . $rowSpan . '"';
+ }
+ $html .= '>';
// Image?
$html .= $this->_writeImageInCell($pSheet, $coordinate);
@@ -1510,13 +1509,13 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
// loop through the individual cells in the individual merge
$r = $fr - 1;
- while($r++ < $lr) {
+ while ($r++ < $lr) {
// also, flag this row as a HTML row that is candidate to be omitted
$candidateSpannedRow[$r] = $r;
$c = $fc - 1;
- while($c++ < $lc) {
- if ( !($c == $fc && $r == $fr) ) {
+ while ($c++ < $lc) {
+ if (!($c == $fc && $r == $fr)) {
// not the upper-left cell (should not be written in HTML)
$this->_isSpannedCell[$sheetIndex][$r][$c] = array(
'baseCell' => array($fr, $fc),
@@ -1546,15 +1545,15 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_
}
// For each of the omitted rows we found above, the affected rowspans should be subtracted by 1
- if ( isset($this->_isSpannedRow[$sheetIndex]) ) {
+ if (isset($this->_isSpannedRow[$sheetIndex])) {
foreach ($this->_isSpannedRow[$sheetIndex] as $rowIndex) {
$adjustedBaseCells = array();
$c = -1;
$e = $countColumns - 1;
- while($c++ < $e) {
+ while ($c++ < $e) {
$baseCell = $this->_isSpannedCell[$sheetIndex][$rowIndex][$c]['baseCell'];
- if ( !in_array($baseCell, $adjustedBaseCells) ) {
+ if (!in_array($baseCell, $adjustedBaseCells)) {
// subtract rowspan by 1
--$this->_isBaseCell[$sheetIndex][ $baseCell[0] ][ $baseCell[1] ]['rowspan'];
$adjustedBaseCells[] = $baseCell;
diff --git a/Classes/PHPExcel/Writer/IWriter.php b/Classes/PHPExcel/Writer/IWriter.php
index fd993db6..c7cfe740 100644
--- a/Classes/PHPExcel/Writer/IWriter.php
+++ b/Classes/PHPExcel/Writer/IWriter.php
@@ -34,5 +34,4 @@ interface PHPExcel_Writer_IWriter
* @throws PHPExcel_Writer_Exception
*/
public function save($pFilename = null);
-
}
diff --git a/Classes/PHPExcel/Writer/OpenDocument/Cell/Comment.php b/Classes/PHPExcel/Writer/OpenDocument/Cell/Comment.php
index c85e36a0..f1e98a16 100644
--- a/Classes/PHPExcel/Writer/OpenDocument/Cell/Comment.php
+++ b/Classes/PHPExcel/Writer/OpenDocument/Cell/Comment.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Writer_OpenDocument
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
diff --git a/Classes/PHPExcel/Writer/OpenDocument/Content.php b/Classes/PHPExcel/Writer/OpenDocument/Content.php
index 1f6ddc4d..2e1986a7 100644
--- a/Classes/PHPExcel/Writer/OpenDocument/Content.php
+++ b/Classes/PHPExcel/Writer/OpenDocument/Content.php
@@ -21,7 +21,7 @@
* @category PHPExcel
* @package PHPExcel_Writer_OpenDocument
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
- * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
+ * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
diff --git a/composer.json b/composer.json
index da7faa0e..a280b88e 100644
--- a/composer.json
+++ b/composer.json
@@ -27,7 +27,7 @@
"ext-xmlwriter": "*"
},
"require-dev": {
- "squizlabs/php_codesniffer": "1.*"
+ "squizlabs/php_codesniffer": "2.*"
},
"recommend": {
"ext-zip": "*",