mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-22 05:16:06 +03:00
PSR-2 : Fixes
This commit is contained in:
parent
e18ba38f16
commit
96f3d0e6ee
@ -98,10 +98,10 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise variables
|
||||
$this->_author = 'Author';
|
||||
$this->_author = 'Author';
|
||||
$this->_text = new PHPExcel_RichText();
|
||||
$this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1');
|
||||
$this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
||||
$this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1');
|
||||
$this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,7 +109,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthor() {
|
||||
public function getAuthor()
|
||||
{
|
||||
return $this->_author;
|
||||
}
|
||||
|
||||
@ -119,7 +120,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setAuthor($pValue = '') {
|
||||
public function setAuthor($pValue = '')
|
||||
{
|
||||
$this->_author = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -129,7 +131,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
*
|
||||
* @return PHPExcel_RichText
|
||||
*/
|
||||
public function getText() {
|
||||
public function getText()
|
||||
{
|
||||
return $this->_text;
|
||||
}
|
||||
|
||||
@ -139,7 +142,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
* @param PHPExcel_RichText $pValue
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setText(PHPExcel_RichText $pValue) {
|
||||
public function setText(PHPExcel_RichText $pValue)
|
||||
{
|
||||
$this->_text = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -149,7 +153,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getWidth() {
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->_width;
|
||||
}
|
||||
|
||||
@ -159,7 +164,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
* @param string $value
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setWidth($value = '96pt') {
|
||||
public function setWidth($value = '96pt')
|
||||
{
|
||||
$this->_width = $value;
|
||||
return $this;
|
||||
}
|
||||
@ -169,7 +175,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHeight() {
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->_height;
|
||||
}
|
||||
|
||||
@ -179,7 +186,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
* @param string $value
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setHeight($value = '55.5pt') {
|
||||
public function setHeight($value = '55.5pt')
|
||||
{
|
||||
$this->_height = $value;
|
||||
return $this;
|
||||
}
|
||||
@ -189,7 +197,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMarginLeft() {
|
||||
public function getMarginLeft()
|
||||
{
|
||||
return $this->_marginLeft;
|
||||
}
|
||||
|
||||
@ -199,7 +208,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
* @param string $value
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setMarginLeft($value = '59.25pt') {
|
||||
public function setMarginLeft($value = '59.25pt')
|
||||
{
|
||||
$this->_marginLeft = $value;
|
||||
return $this;
|
||||
}
|
||||
@ -209,7 +219,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMarginTop() {
|
||||
public function getMarginTop()
|
||||
{
|
||||
return $this->_marginTop;
|
||||
}
|
||||
|
||||
@ -219,7 +230,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
* @param string $value
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setMarginTop($value = '1.5pt') {
|
||||
public function setMarginTop($value = '1.5pt')
|
||||
{
|
||||
$this->_marginTop = $value;
|
||||
return $this;
|
||||
}
|
||||
@ -229,7 +241,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getVisible() {
|
||||
public function getVisible()
|
||||
{
|
||||
return $this->_visible;
|
||||
}
|
||||
|
||||
@ -239,7 +252,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setVisible($value = false) {
|
||||
public function setVisible($value = false)
|
||||
{
|
||||
$this->_visible = $value;
|
||||
return $this;
|
||||
}
|
||||
@ -249,7 +263,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
*
|
||||
* @return PHPExcel_Style_Color
|
||||
*/
|
||||
public function getFillColor() {
|
||||
public function getFillColor()
|
||||
{
|
||||
return $this->_fillColor;
|
||||
}
|
||||
|
||||
@ -259,7 +274,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_Comment
|
||||
*/
|
||||
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) {
|
||||
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
|
||||
{
|
||||
$this->_alignment = $pValue;
|
||||
return $this;
|
||||
}
|
||||
@ -269,7 +285,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAlignment() {
|
||||
public function getAlignment()
|
||||
{
|
||||
return $this->_alignment;
|
||||
}
|
||||
|
||||
@ -278,9 +295,10 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode() {
|
||||
public function getHashCode()
|
||||
{
|
||||
return md5(
|
||||
$this->_author
|
||||
$this->_author
|
||||
. $this->_text->getHashCode()
|
||||
. $this->_width
|
||||
. $this->_height
|
||||
@ -296,7 +314,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
@ -312,8 +331,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString() {
|
||||
public function __toString()
|
||||
{
|
||||
return $this->_text->getPlainText();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,7 +33,8 @@
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
class PHPExcel_Exception extends Exception {
|
||||
class PHPExcel_Exception extends Exception
|
||||
{
|
||||
/**
|
||||
* Error handler callback
|
||||
*
|
||||
@ -43,7 +44,8 @@ class PHPExcel_Exception extends Exception {
|
||||
* @param mixed $line
|
||||
* @param mixed $context
|
||||
*/
|
||||
public static function errorHandlerCallback($code, $string, $file, $line, $context) {
|
||||
public static function errorHandlerCallback($code, $string, $file, $line, $context)
|
||||
{
|
||||
$e = new self($string, $code);
|
||||
$e->line = $line;
|
||||
$e->file = $file;
|
||||
|
@ -157,7 +157,7 @@ class PHPExcel_HashTable
|
||||
public function getByIndex($pIndex = 0)
|
||||
{
|
||||
if (isset($this->_keyMap[$pIndex])) {
|
||||
return $this->getByHashCode( $this->_keyMap[$pIndex] );
|
||||
return $this->getByHashCode($this->_keyMap[$pIndex]);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -69,7 +69,9 @@ class PHPExcel_IOFactory
|
||||
/**
|
||||
* Private constructor for PHPExcel_IOFactory
|
||||
*/
|
||||
private function __construct() { }
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get search locations
|
||||
@ -135,7 +137,7 @@ class PHPExcel_IOFactory
|
||||
$className = str_replace('{0}', $writerType, $searchLocation['class']);
|
||||
|
||||
$instance = new $className($phpExcel);
|
||||
if ($instance !== NULL) {
|
||||
if ($instance !== null) {
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
@ -165,7 +167,7 @@ class PHPExcel_IOFactory
|
||||
$className = str_replace('{0}', $readerType, $searchLocation['class']);
|
||||
|
||||
$instance = new $className();
|
||||
if ($instance !== NULL) {
|
||||
if ($instance !== null) {
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
@ -222,7 +224,7 @@ class PHPExcel_IOFactory
|
||||
// First, lucky guess by inspecting file extension
|
||||
$pathinfo = pathinfo($pFilename);
|
||||
|
||||
$extensionType = NULL;
|
||||
$extensionType = null;
|
||||
if (isset($pathinfo['extension'])) {
|
||||
switch (strtolower($pathinfo['extension'])) {
|
||||
case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet
|
||||
|
@ -75,7 +75,7 @@ class PHPExcel_NamedRange
|
||||
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
|
||||
{
|
||||
// Validate data
|
||||
if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) {
|
||||
if (($pName === null) || ($pWorksheet === null) || ($pRange === null)) {
|
||||
throw new PHPExcel_Exception('Parameters can not be null.');
|
||||
}
|
||||
|
||||
@ -93,7 +93,8 @@ class PHPExcel_NamedRange
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
@ -103,18 +104,19 @@ class PHPExcel_NamedRange
|
||||
* @param string $value
|
||||
* @return PHPExcel_NamedRange
|
||||
*/
|
||||
public function setName($value = null) {
|
||||
if ($value !== NULL) {
|
||||
public function setName($value = null)
|
||||
{
|
||||
if ($value !== null) {
|
||||
// Old title
|
||||
$oldTitle = $this->_name;
|
||||
|
||||
// Re-attach
|
||||
if ($this->_worksheet !== NULL) {
|
||||
if ($this->_worksheet !== null) {
|
||||
$this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet);
|
||||
}
|
||||
$this->_name = $value;
|
||||
|
||||
if ($this->_worksheet !== NULL) {
|
||||
if ($this->_worksheet !== null) {
|
||||
$this->_worksheet->getParent()->addNamedRange($this);
|
||||
}
|
||||
|
||||
@ -130,7 +132,8 @@ class PHPExcel_NamedRange
|
||||
*
|
||||
* @return PHPExcel_Worksheet
|
||||
*/
|
||||
public function getWorksheet() {
|
||||
public function getWorksheet()
|
||||
{
|
||||
return $this->_worksheet;
|
||||
}
|
||||
|
||||
@ -140,8 +143,9 @@ class PHPExcel_NamedRange
|
||||
* @param PHPExcel_Worksheet $value
|
||||
* @return PHPExcel_NamedRange
|
||||
*/
|
||||
public function setWorksheet(PHPExcel_Worksheet $value = null) {
|
||||
if ($value !== NULL) {
|
||||
public function setWorksheet(PHPExcel_Worksheet $value = null)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->_worksheet = $value;
|
||||
}
|
||||
return $this;
|
||||
@ -152,7 +156,8 @@ class PHPExcel_NamedRange
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRange() {
|
||||
public function getRange()
|
||||
{
|
||||
return $this->_range;
|
||||
}
|
||||
|
||||
@ -162,8 +167,9 @@ class PHPExcel_NamedRange
|
||||
* @param string $value
|
||||
* @return PHPExcel_NamedRange
|
||||
*/
|
||||
public function setRange($value = null) {
|
||||
if ($value !== NULL) {
|
||||
public function setRange($value = null)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->_range = $value;
|
||||
}
|
||||
return $this;
|
||||
@ -174,7 +180,8 @@ class PHPExcel_NamedRange
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getLocalOnly() {
|
||||
public function getLocalOnly()
|
||||
{
|
||||
return $this->_localOnly;
|
||||
}
|
||||
|
||||
@ -184,7 +191,8 @@ class PHPExcel_NamedRange
|
||||
* @param bool $value
|
||||
* @return PHPExcel_NamedRange
|
||||
*/
|
||||
public function setLocalOnly($value = false) {
|
||||
public function setLocalOnly($value = false)
|
||||
{
|
||||
$this->_localOnly = $value;
|
||||
$this->_scope = $value ? $this->_worksheet : null;
|
||||
return $this;
|
||||
@ -195,7 +203,8 @@ class PHPExcel_NamedRange
|
||||
*
|
||||
* @return PHPExcel_Worksheet|null
|
||||
*/
|
||||
public function getScope() {
|
||||
public function getScope()
|
||||
{
|
||||
return $this->_scope;
|
||||
}
|
||||
|
||||
@ -205,7 +214,8 @@ class PHPExcel_NamedRange
|
||||
* @param PHPExcel_Worksheet|null $value
|
||||
* @return PHPExcel_NamedRange
|
||||
*/
|
||||
public function setScope(PHPExcel_Worksheet $value = null) {
|
||||
public function setScope(PHPExcel_Worksheet $value = null)
|
||||
{
|
||||
$this->_scope = $value;
|
||||
$this->_localOnly = ($value == null) ? false : true;
|
||||
return $this;
|
||||
@ -218,14 +228,16 @@ class PHPExcel_NamedRange
|
||||
* @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
|
||||
* @return PHPExcel_NamedRange
|
||||
*/
|
||||
public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet) {
|
||||
public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet)
|
||||
{
|
||||
return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||
*/
|
||||
public function __clone() {
|
||||
public function __clone()
|
||||
{
|
||||
$vars = get_object_vars($this);
|
||||
foreach ($vars as $key => $value) {
|
||||
if (is_object($value)) {
|
||||
|
@ -46,8 +46,9 @@ class PHPExcel_ReferenceHelper
|
||||
*
|
||||
* @return PHPExcel_ReferenceHelper
|
||||
*/
|
||||
public static function getInstance() {
|
||||
if (!isset(self::$_instance) || (self::$_instance === NULL)) {
|
||||
public static function getInstance()
|
||||
{
|
||||
if (!isset(self::$_instance) || (self::$_instance === null)) {
|
||||
self::$_instance = new PHPExcel_ReferenceHelper();
|
||||
}
|
||||
|
||||
@ -57,7 +58,8 @@ class PHPExcel_ReferenceHelper
|
||||
/**
|
||||
* Create a new PHPExcel_ReferenceHelper
|
||||
*/
|
||||
protected function __construct() {
|
||||
protected function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,7 +70,8 @@ class PHPExcel_ReferenceHelper
|
||||
* @param string $b Second column to test (e.g. 'Z')
|
||||
* @return integer
|
||||
*/
|
||||
public static function columnSort($a, $b) {
|
||||
public static function columnSort($a, $b)
|
||||
{
|
||||
return strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
||||
}
|
||||
|
||||
@ -80,7 +83,8 @@ class PHPExcel_ReferenceHelper
|
||||
* @param string $b Second column to test (e.g. 'Z')
|
||||
* @return integer
|
||||
*/
|
||||
public static function columnReverseSort($a, $b) {
|
||||
public static function columnReverseSort($a, $b)
|
||||
{
|
||||
return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
|
||||
}
|
||||
|
||||
@ -92,9 +96,10 @@ class PHPExcel_ReferenceHelper
|
||||
* @param string $b Second cell to test (e.g. 'Z1')
|
||||
* @return integer
|
||||
*/
|
||||
public static function cellSort($a, $b) {
|
||||
sscanf($a,'%[A-Z]%d', $ac, $ar);
|
||||
sscanf($b,'%[A-Z]%d', $bc, $br);
|
||||
public static function cellSort($a, $b)
|
||||
{
|
||||
sscanf($a, '%[A-Z]%d', $ac, $ar);
|
||||
sscanf($b, '%[A-Z]%d', $bc, $br);
|
||||
|
||||
if ($ar == $br) {
|
||||
return strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
|
||||
@ -110,9 +115,10 @@ class PHPExcel_ReferenceHelper
|
||||
* @param string $b Second cell to test (e.g. 'Z1')
|
||||
* @return integer
|
||||
*/
|
||||
public static function cellReverseSort($a, $b) {
|
||||
sscanf($a,'%[A-Z]%d', $ac, $ar);
|
||||
sscanf($b,'%[A-Z]%d', $bc, $br);
|
||||
public static function cellReverseSort($a, $b)
|
||||
{
|
||||
sscanf($a, '%[A-Z]%d', $ac, $ar);
|
||||
sscanf($b, '%[A-Z]%d', $bc, $br);
|
||||
|
||||
if ($ar == $br) {
|
||||
return 1 - strcasecmp(strlen($ac) . $ac, strlen($bc) . $bc);
|
||||
@ -130,20 +136,21 @@ class PHPExcel_ReferenceHelper
|
||||
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
|
||||
* @return boolean
|
||||
*/
|
||||
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols) {
|
||||
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)
|
||||
{
|
||||
list($cellColumn, $cellRow) = PHPExcel_Cell::coordinateFromString($cellAddress);
|
||||
$cellColumnIndex = PHPExcel_Cell::columnIndexFromString($cellColumn);
|
||||
// Is cell within the range of rows/columns if we're deleting
|
||||
if ($pNumRows < 0 &&
|
||||
($cellRow >= ($beforeRow + $pNumRows)) &&
|
||||
($cellRow < $beforeRow)) {
|
||||
return TRUE;
|
||||
return true;
|
||||
} elseif ($pNumCols < 0 &&
|
||||
($cellColumnIndex >= ($beforeColumnIndex + $pNumCols)) &&
|
||||
($cellColumnIndex < $beforeColumnIndex)) {
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -198,7 +205,7 @@ class PHPExcel_ReferenceHelper
|
||||
foreach ($aComments as $key => &$value) {
|
||||
// Any comments inside a deleted range will be ignored
|
||||
if (!self::cellAddressInDeleteRange($key, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)) {
|
||||
// Otherwise build a new array of comments indexed by the adjusted cell reference
|
||||
// Otherwise build a new array of comments indexed by the adjusted cell reference
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
$aNewComments[$newReference] = $value;
|
||||
}
|
||||
@ -220,15 +227,13 @@ class PHPExcel_ReferenceHelper
|
||||
protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
{
|
||||
$aHyperlinkCollection = $pSheet->getHyperlinkCollection();
|
||||
($pNumCols > 0 || $pNumRows > 0) ?
|
||||
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
|
||||
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||
($pNumCols > 0 || $pNumRows > 0) ? uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||
|
||||
foreach ($aHyperlinkCollection as $key => $value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
if ($key != $newReference) {
|
||||
$pSheet->setHyperlink( $newReference, $value );
|
||||
$pSheet->setHyperlink( $key, null );
|
||||
$pSheet->setHyperlink($newReference, $value);
|
||||
$pSheet->setHyperlink($key, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -246,14 +251,13 @@ class PHPExcel_ReferenceHelper
|
||||
protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
|
||||
{
|
||||
$aDataValidationCollection = $pSheet->getDataValidationCollection();
|
||||
($pNumCols > 0 || $pNumRows > 0) ?
|
||||
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
|
||||
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||
($pNumCols > 0 || $pNumRows > 0) ? uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
|
||||
|
||||
foreach ($aDataValidationCollection as $key => $value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
if ($key != $newReference) {
|
||||
$pSheet->setDataValidation( $newReference, $value );
|
||||
$pSheet->setDataValidation( $key, null );
|
||||
$pSheet->setDataValidation($newReference, $value);
|
||||
$pSheet->setDataValidation($key, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -298,8 +302,8 @@ class PHPExcel_ReferenceHelper
|
||||
foreach ($aProtectedCells as $key => $value) {
|
||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||
if ($key != $newReference) {
|
||||
$pSheet->protectCells( $newReference, $value, true );
|
||||
$pSheet->unprotectCells( $key );
|
||||
$pSheet->protectCells($newReference, $value, true);
|
||||
$pSheet->unprotectCells($key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -372,7 +376,7 @@ class PHPExcel_ReferenceHelper
|
||||
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = NULL)
|
||||
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = null)
|
||||
{
|
||||
$remove = ($pNumCols < 0 || $pNumRows < 0);
|
||||
$aCellCollection = $pSheet->getCellCollection();
|
||||
@ -442,8 +446,7 @@ class PHPExcel_ReferenceHelper
|
||||
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
||||
// Formula should be adjusted
|
||||
$pSheet->getCell($newCoordinates)
|
||||
->setValue($this->updateFormulaReferences($cell->getValue(),
|
||||
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
|
||||
->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
|
||||
} else {
|
||||
// Formula should not be adjusted
|
||||
$pSheet->getCell($newCoordinates)->setValue($cell->getValue());
|
||||
@ -451,14 +454,12 @@ class PHPExcel_ReferenceHelper
|
||||
|
||||
// Clear the original cell
|
||||
$pSheet->getCellCacheController()->deleteCacheData($cellID);
|
||||
|
||||
} else {
|
||||
/* We don't need to update styles for rows/columns before our insertion position,
|
||||
but we do still need to adjust any formulae in those cells */
|
||||
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
||||
// Formula should be adjusted
|
||||
$cell->setValue($this->updateFormulaReferences($cell->getValue(),
|
||||
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
|
||||
$cell->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
|
||||
}
|
||||
|
||||
}
|
||||
@ -472,7 +473,7 @@ class PHPExcel_ReferenceHelper
|
||||
for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) {
|
||||
|
||||
// Style
|
||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex( $beforeColumnIndex - 2 ) . $i;
|
||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex($beforeColumnIndex - 2) . $i;
|
||||
if ($pSheet->cellExists($coordinate)) {
|
||||
$xfIndex = $pSheet->getCell($coordinate)->getXfIndex();
|
||||
$conditionalStyles = $pSheet->conditionalStylesExists($coordinate) ?
|
||||
@ -594,17 +595,17 @@ class PHPExcel_ReferenceHelper
|
||||
}
|
||||
}
|
||||
}
|
||||
$pSheet->setAutoFilter( $this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows) );
|
||||
$pSheet->setAutoFilter($this->updateCellReference($autoFilterRange, $pBefore, $pNumCols, $pNumRows));
|
||||
}
|
||||
|
||||
// Update worksheet: freeze pane
|
||||
if ($pSheet->getFreezePane() != '') {
|
||||
$pSheet->freezePane( $this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows) );
|
||||
$pSheet->freezePane($this->updateCellReference($pSheet->getFreezePane(), $pBefore, $pNumCols, $pNumRows));
|
||||
}
|
||||
|
||||
// Page setup
|
||||
if ($pSheet->getPageSetup()->isPrintAreaSet()) {
|
||||
$pSheet->getPageSetup()->setPrintArea( $this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows) );
|
||||
$pSheet->getPageSetup()->setPrintArea($this->updateCellReference($pSheet->getPageSetup()->getPrintArea(), $pBefore, $pNumCols, $pNumRows));
|
||||
}
|
||||
|
||||
// Update worksheet: drawings
|
||||
@ -620,9 +621,7 @@ class PHPExcel_ReferenceHelper
|
||||
if (count($pSheet->getParent()->getNamedRanges()) > 0) {
|
||||
foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) {
|
||||
if ($namedRange->getWorksheet()->getHashCode() == $pSheet->getHashCode()) {
|
||||
$namedRange->setRange(
|
||||
$this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows)
|
||||
);
|
||||
$namedRange->setRange($this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -642,7 +641,8 @@ class PHPExcel_ReferenceHelper
|
||||
* @return string Updated formula
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') {
|
||||
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '')
|
||||
{
|
||||
// Update cell references in the formula
|
||||
$formulaBlocks = explode('"', $pFormula);
|
||||
$i = false;
|
||||
@ -657,8 +657,8 @@ class PHPExcel_ReferenceHelper
|
||||
foreach ($matches as $match) {
|
||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$fromString .= $match[3].':'.$match[4];
|
||||
$modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows),2);
|
||||
$modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows),2);
|
||||
$modified3 = substr($this->updateCellReference('$A'.$match[3], $pBefore, $pNumCols, $pNumRows), 2);
|
||||
$modified4 = substr($this->updateCellReference('$A'.$match[4], $pBefore, $pNumCols, $pNumRows), 2);
|
||||
|
||||
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
|
||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||
@ -682,8 +682,8 @@ class PHPExcel_ReferenceHelper
|
||||
foreach ($matches as $match) {
|
||||
$fromString = ($match[2] > '') ? $match[2].'!' : '';
|
||||
$fromString .= $match[3].':'.$match[4];
|
||||
$modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows),0,-2);
|
||||
$modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows),0,-2);
|
||||
$modified3 = substr($this->updateCellReference($match[3].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
|
||||
$modified4 = substr($this->updateCellReference($match[4].'$1', $pBefore, $pNumCols, $pNumRows), 0, -2);
|
||||
|
||||
if ($match[3].':'.$match[4] !== $modified3.':'.$modified4) {
|
||||
if (($match[2] == '') || (trim($match[2],"'") == $sheetName)) {
|
||||
@ -781,7 +781,8 @@ class PHPExcel_ReferenceHelper
|
||||
* @return string Updated cell range
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
||||
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
|
||||
{
|
||||
// Is it in another worksheet? Will not have to update anything.
|
||||
if (strpos($pCellRange, "!") !== false) {
|
||||
return $pCellRange;
|
||||
@ -805,7 +806,8 @@ class PHPExcel_ReferenceHelper
|
||||
* @param string $oldName Old name (name to replace)
|
||||
* @param string $newName New name
|
||||
*/
|
||||
public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '') {
|
||||
public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '')
|
||||
{
|
||||
if ($oldName == '') {
|
||||
return;
|
||||
}
|
||||
@ -813,7 +815,7 @@ class PHPExcel_ReferenceHelper
|
||||
foreach ($pPhpExcel->getWorksheetIterator() as $sheet) {
|
||||
foreach ($sheet->getCellCollection(false) as $cellID) {
|
||||
$cell = $sheet->getCell($cellID);
|
||||
if (($cell !== NULL) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) {
|
||||
if (($cell !== null) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) {
|
||||
$formula = $cell->getValue();
|
||||
if (strpos($formula, $oldName) !== false) {
|
||||
$formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula);
|
||||
@ -835,7 +837,8 @@ class PHPExcel_ReferenceHelper
|
||||
* @return string Updated cell range
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
||||
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
|
||||
{
|
||||
if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) {
|
||||
// Update range
|
||||
$range = PHPExcel_Cell::splitRange($pCellRange);
|
||||
@ -872,23 +875,22 @@ class PHPExcel_ReferenceHelper
|
||||
* @return string Updated cell reference
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
||||
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
|
||||
{
|
||||
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
|
||||
// Get coordinates of $pBefore
|
||||
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString( $pBefore );
|
||||
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore);
|
||||
|
||||
// Get coordinates of $pCellReference
|
||||
list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString( $pCellReference );
|
||||
list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString($pCellReference);
|
||||
|
||||
// Verify which parts should be updated
|
||||
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') &&
|
||||
PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn));
|
||||
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') &&
|
||||
$newRow >= $beforeRow);
|
||||
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') && (PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)));
|
||||
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') && $newRow >= $beforeRow);
|
||||
|
||||
// Create new column reference
|
||||
if ($updateColumn) {
|
||||
$newColumn = PHPExcel_Cell::stringFromColumnIndex( PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols );
|
||||
$newColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($newColumn) - 1 + $pNumCols);
|
||||
}
|
||||
|
||||
// Create new row reference
|
||||
@ -908,7 +910,8 @@ class PHPExcel_ReferenceHelper
|
||||
*
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public final function __clone() {
|
||||
final public function __clone()
|
||||
{
|
||||
throw new PHPExcel_Exception("Cloning a Singleton is not allowed!");
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ class PHPExcel_Shared_Drawing
|
||||
* @param int $pValue Value in pixels
|
||||
* @return int Value in EMU
|
||||
*/
|
||||
public static function pixelsToEMU($pValue = 0) {
|
||||
public static function pixelsToEMU($pValue = 0)
|
||||
{
|
||||
return round($pValue * 9525);
|
||||
}
|
||||
|
||||
@ -51,7 +52,8 @@ class PHPExcel_Shared_Drawing
|
||||
* @param int $pValue Value in EMU
|
||||
* @return int Value in pixels
|
||||
*/
|
||||
public static function EMUToPixels($pValue = 0) {
|
||||
public static function EMUToPixels($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return round($pValue / 9525);
|
||||
} else {
|
||||
@ -68,22 +70,19 @@ class PHPExcel_Shared_Drawing
|
||||
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
|
||||
* @return int Value in cell dimension
|
||||
*/
|
||||
public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont) {
|
||||
public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont)
|
||||
{
|
||||
// Font name and size
|
||||
$name = $pDefaultFont->getName();
|
||||
$size = $pDefaultFont->getSize();
|
||||
|
||||
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
|
||||
// Exact width can be determined
|
||||
$colWidth = $pValue
|
||||
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width']
|
||||
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'];
|
||||
$colWidth = $pValue * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'] / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'];
|
||||
} else {
|
||||
// We don't have data for this particular font and size, use approximation by
|
||||
// extrapolating from Calibri 11
|
||||
$colWidth = $pValue * 11
|
||||
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width']
|
||||
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size;
|
||||
$colWidth = $pValue * 11 * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size;
|
||||
}
|
||||
|
||||
return $colWidth;
|
||||
@ -96,23 +95,19 @@ class PHPExcel_Shared_Drawing
|
||||
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
|
||||
* @return int Value in pixels
|
||||
*/
|
||||
public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont) {
|
||||
public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont)
|
||||
{
|
||||
// Font name and size
|
||||
$name = $pDefaultFont->getName();
|
||||
$size = $pDefaultFont->getSize();
|
||||
|
||||
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
|
||||
// Exact width can be determined
|
||||
$colWidth = $pValue
|
||||
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px']
|
||||
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
|
||||
|
||||
$colWidth = $pValue * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
|
||||
} else {
|
||||
// We don't have data for this particular font and size, use approximation by
|
||||
// extrapolating from Calibri 11
|
||||
$colWidth = $pValue * $size
|
||||
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px']
|
||||
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
|
||||
$colWidth = $pValue * $size * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
|
||||
}
|
||||
|
||||
// Round pixels to closest integer
|
||||
@ -127,7 +122,8 @@ class PHPExcel_Shared_Drawing
|
||||
* @param int $pValue Value in pixels
|
||||
* @return int Value in points
|
||||
*/
|
||||
public static function pixelsToPoints($pValue = 0) {
|
||||
public static function pixelsToPoints($pValue = 0)
|
||||
{
|
||||
return $pValue * 0.67777777;
|
||||
}
|
||||
|
||||
@ -137,7 +133,8 @@ class PHPExcel_Shared_Drawing
|
||||
* @param int $pValue Value in points
|
||||
* @return int Value in pixels
|
||||
*/
|
||||
public static function pointsToPixels($pValue = 0) {
|
||||
public static function pointsToPixels($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return (int) ceil($pValue * 1.333333333);
|
||||
} else {
|
||||
@ -151,7 +148,8 @@ class PHPExcel_Shared_Drawing
|
||||
* @param int $pValue Degrees
|
||||
* @return int Angle
|
||||
*/
|
||||
public static function degreesToAngle($pValue = 0) {
|
||||
public static function degreesToAngle($pValue = 0)
|
||||
{
|
||||
return (int)round($pValue * 60000);
|
||||
}
|
||||
|
||||
@ -161,7 +159,8 @@ class PHPExcel_Shared_Drawing
|
||||
* @param int $pValue Angle
|
||||
* @return int Degrees
|
||||
*/
|
||||
public static function angleToDegrees($pValue = 0) {
|
||||
public static function angleToDegrees($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return round($pValue / 60000);
|
||||
} else {
|
||||
@ -179,94 +178,93 @@ class PHPExcel_Shared_Drawing
|
||||
public static function imagecreatefrombmp($p_sFile)
|
||||
{
|
||||
// Load the image into a string
|
||||
$file = fopen($p_sFile,"rb");
|
||||
$read = fread($file,10);
|
||||
while (!feof($file)&&($read<>""))
|
||||
$read .= fread($file,1024);
|
||||
$file = fopen($p_sFile, "rb");
|
||||
$read = fread($file, 10);
|
||||
while (!feof($file) && ($read<>"")) {
|
||||
$read .= fread($file, 1024);
|
||||
}
|
||||
|
||||
$temp = unpack("H*", $read);
|
||||
$hex = $temp[1];
|
||||
$header = substr($hex,0,108);
|
||||
$temp = unpack("H*", $read);
|
||||
$hex = $temp[1];
|
||||
$header = substr($hex, 0, 108);
|
||||
|
||||
// Process the header
|
||||
// Structure: http://www.fastgraph.com/help/bmp_header_format.html
|
||||
if (substr($header,0,4)=="424d")
|
||||
{
|
||||
if (substr($header, 0, 4)=="424d") {
|
||||
// Cut it in parts of 2 bytes
|
||||
$header_parts = str_split($header,2);
|
||||
$header_parts = str_split($header, 2);
|
||||
|
||||
// Get the width 4 bytes
|
||||
$width = hexdec($header_parts[19].$header_parts[18]);
|
||||
$width = hexdec($header_parts[19].$header_parts[18]);
|
||||
|
||||
// Get the height 4 bytes
|
||||
$height = hexdec($header_parts[23].$header_parts[22]);
|
||||
$height = hexdec($header_parts[23].$header_parts[22]);
|
||||
|
||||
// Unset the header params
|
||||
unset($header_parts);
|
||||
}
|
||||
|
||||
// Define starting X and Y
|
||||
$x = 0;
|
||||
$y = 1;
|
||||
$x = 0;
|
||||
$y = 1;
|
||||
|
||||
// Create newimage
|
||||
$image = imagecreatetruecolor($width, $height);
|
||||
$image = imagecreatetruecolor($width, $height);
|
||||
|
||||
// Grab the body from the image
|
||||
$body = substr($hex,108);
|
||||
$body = substr($hex, 108);
|
||||
|
||||
// Calculate if padding at the end-line is needed
|
||||
// Divided by two to keep overview.
|
||||
// 1 byte = 2 HEX-chars
|
||||
$body_size = (strlen($body)/2);
|
||||
$header_size = ($width*$height);
|
||||
$body_size = (strlen($body)/2);
|
||||
$header_size = ($width*$height);
|
||||
|
||||
// Use end-line padding? Only when needed
|
||||
$usePadding = ($body_size>($header_size*3)+4);
|
||||
$usePadding = ($body_size>($header_size*3)+4);
|
||||
|
||||
// Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption
|
||||
// Calculate the next DWORD-position in the body
|
||||
for ($i=0;$i<$body_size;$i+=3)
|
||||
{
|
||||
for ($i = 0 ; $i < $body_size ; $i += 3) {
|
||||
// Calculate line-ending and padding
|
||||
if ($x>=$width)
|
||||
{
|
||||
// If padding needed, ignore image-padding
|
||||
// Shift i to the ending of the current 32-bit-block
|
||||
if ($usePadding)
|
||||
$i += $width%4;
|
||||
if ($x >= $width) {
|
||||
// If padding needed, ignore image-padding
|
||||
// Shift i to the ending of the current 32-bit-block
|
||||
if ($usePadding) {
|
||||
$i += $width%4;
|
||||
}
|
||||
|
||||
// Reset horizontal position
|
||||
$x = 0;
|
||||
$x = 0;
|
||||
|
||||
// Raise the height-position (bottom-up)
|
||||
$y++;
|
||||
|
||||
// Reached the image-height? Break the for-loop
|
||||
if ($y>$height)
|
||||
if ($y > $height) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Calculation of the RGB-pixel (defined as BGR in image-data)
|
||||
// Define $i_pos as absolute position in the body
|
||||
$i_pos = $i*2;
|
||||
$r = hexdec($body[$i_pos+4].$body[$i_pos+5]);
|
||||
$g = hexdec($body[$i_pos+2].$body[$i_pos+3]);
|
||||
$b = hexdec($body[$i_pos].$body[$i_pos+1]);
|
||||
// Calculation of the RGB-pixel (defined as BGR in image-data)
|
||||
// Define $i_pos as absolute position in the body
|
||||
$i_pos = $i * 2;
|
||||
$r = hexdec($body[$i_pos+4].$body[$i_pos+5]);
|
||||
$g = hexdec($body[$i_pos+2].$body[$i_pos+3]);
|
||||
$b = hexdec($body[$i_pos].$body[$i_pos+1]);
|
||||
|
||||
// Calculate and draw the pixel
|
||||
$color = imagecolorallocate($image, $r, $g, $b);
|
||||
// Calculate and draw the pixel
|
||||
$color = imagecolorallocate($image, $r, $g, $b);
|
||||
imagesetpixel($image, $x, $height-$y, $color);
|
||||
|
||||
// Raise the horizontal position
|
||||
// Raise the horizontal position
|
||||
$x++;
|
||||
}
|
||||
|
||||
// Unset the body / free the memory
|
||||
// Unset the body / free the memory
|
||||
unset($body);
|
||||
|
||||
// Return image-object
|
||||
return $image;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -87,5 +87,4 @@ class PHPExcel_Shared_Escher
|
||||
{
|
||||
return $this->_dgContainer = $dgContainer;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class PHPExcel_Shared_File
|
||||
* @protected
|
||||
* @var boolean
|
||||
*/
|
||||
protected static $_useUploadTempDirectory = FALSE;
|
||||
protected static $_useUploadTempDirectory = false;
|
||||
|
||||
|
||||
/**
|
||||
@ -49,9 +49,10 @@ class PHPExcel_Shared_File
|
||||
*
|
||||
* @param boolean $useUploadTempDir Use File Upload Temporary directory (true or false)
|
||||
*/
|
||||
public static function setUseUploadTempDirectory($useUploadTempDir = FALSE) {
|
||||
public static function setUseUploadTempDirectory($useUploadTempDir = false)
|
||||
{
|
||||
self::$_useUploadTempDirectory = (boolean) $useUploadTempDir;
|
||||
} // function setUseUploadTempDirectory()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -59,9 +60,10 @@ class PHPExcel_Shared_File
|
||||
*
|
||||
* @return boolean Use File Upload Temporary directory (true or false)
|
||||
*/
|
||||
public static function getUseUploadTempDirectory() {
|
||||
public static function getUseUploadTempDirectory()
|
||||
{
|
||||
return self::$_useUploadTempDirectory;
|
||||
} // function getUseUploadTempDirectory()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -70,11 +72,12 @@ class PHPExcel_Shared_File
|
||||
* @param string $pFilename Filename
|
||||
* @return bool
|
||||
*/
|
||||
public static function file_exists($pFilename) {
|
||||
public static function file_exists($pFilename)
|
||||
{
|
||||
// Sick construction, but it seems that
|
||||
// file_exists returns strange values when
|
||||
// doing the original file_exists on ZIP archives...
|
||||
if ( strtolower(substr($pFilename, 0, 3)) == 'zip' ) {
|
||||
if (strtolower(substr($pFilename, 0, 3)) == 'zip') {
|
||||
// Open ZIP file and verify if the file exists
|
||||
$zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6);
|
||||
$archiveFile = substr($pFilename, strpos($pFilename, '#') + 1);
|
||||
@ -99,7 +102,8 @@ class PHPExcel_Shared_File
|
||||
* @param string $pFilename
|
||||
* @return string
|
||||
*/
|
||||
public static function realpath($pFilename) {
|
||||
public static function realpath($pFilename)
|
||||
{
|
||||
// Returnvalue
|
||||
$returnValue = '';
|
||||
|
||||
@ -109,8 +113,8 @@ class PHPExcel_Shared_File
|
||||
}
|
||||
|
||||
// Found something?
|
||||
if ($returnValue == '' || ($returnValue === NULL)) {
|
||||
$pathArray = explode('/' , $pFilename);
|
||||
if ($returnValue == '' || ($returnValue === null)) {
|
||||
$pathArray = explode('/', $pFilename);
|
||||
while (in_array('..', $pathArray) && $pathArray[0] != '..') {
|
||||
for ($i = 0; $i < count($pathArray); ++$i) {
|
||||
if ($pathArray[$i] == '..' && $i > 0) {
|
||||
@ -137,10 +141,11 @@ class PHPExcel_Shared_File
|
||||
if (self::$_useUploadTempDirectory) {
|
||||
// use upload-directory when defined to allow running on environments having very restricted
|
||||
// open_basedir configs
|
||||
if (ini_get('upload_tmp_dir') !== FALSE) {
|
||||
if (ini_get('upload_tmp_dir') !== false) {
|
||||
if ($temp = ini_get('upload_tmp_dir')) {
|
||||
if (file_exists($temp))
|
||||
if (file_exists($temp)) {
|
||||
return realpath($temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -149,13 +154,19 @@ class PHPExcel_Shared_File
|
||||
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
|
||||
if ( !function_exists('sys_get_temp_dir')) {
|
||||
if ($temp = getenv('TMP') ) {
|
||||
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
|
||||
if ((!empty($temp)) && (file_exists($temp))) {
|
||||
return realpath($temp);
|
||||
}
|
||||
}
|
||||
if ($temp = getenv('TEMP') ) {
|
||||
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
|
||||
if ((!empty($temp)) && (file_exists($temp))) {
|
||||
return realpath($temp);
|
||||
}
|
||||
}
|
||||
if ($temp = getenv('TMPDIR') ) {
|
||||
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
|
||||
if ((!empty($temp)) && (file_exists($temp))) {
|
||||
return realpath($temp);
|
||||
}
|
||||
}
|
||||
|
||||
// trick for creating a file in system's temporary dir
|
||||
@ -174,5 +185,4 @@ class PHPExcel_Shared_File
|
||||
// be called if we're running 5.2.1 or earlier
|
||||
return realpath(sys_get_temp_dir());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ class PHPExcel_Shared_OLE
|
||||
for ($i = 0; $i < $bbatBlockCount; ++$i) {
|
||||
$pos = $this->_getBlockOffset($mbatBlocks[$i]);
|
||||
fseek($fh, $pos);
|
||||
for ($j = 0 ; $j < $this->bigBlockSize / 4; ++$j) {
|
||||
for ($j = 0; $j < $this->bigBlockSize / 4; ++$j) {
|
||||
$this->bbat[] = self::_readInt4($fh);
|
||||
}
|
||||
}
|
||||
@ -198,8 +198,7 @@ class PHPExcel_Shared_OLE
|
||||
{
|
||||
static $isRegistered = false;
|
||||
if (!$isRegistered) {
|
||||
stream_wrapper_register('ole-chainedblockstream',
|
||||
'PHPExcel_Shared_OLE_ChainedBlockStream');
|
||||
stream_wrapper_register('ole-chainedblockstream', 'PHPExcel_Shared_OLE_ChainedBlockStream');
|
||||
$isRegistered = true;
|
||||
}
|
||||
|
||||
@ -266,7 +265,7 @@ class PHPExcel_Shared_OLE
|
||||
public function _readPpsWks($blockId)
|
||||
{
|
||||
$fh = $this->getStream($blockId);
|
||||
for ($pos = 0; ; $pos += 128) {
|
||||
for ($pos = 0;; $pos += 128) {
|
||||
fseek($fh, $pos, SEEK_SET);
|
||||
$nameUtf16 = fread($fh, 64);
|
||||
$nameLength = self::_readInt2($fh);
|
||||
@ -275,19 +274,18 @@ class PHPExcel_Shared_OLE
|
||||
$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;
|
||||
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;
|
||||
@ -304,9 +302,7 @@ class PHPExcel_Shared_OLE
|
||||
$this->_list[] = $pps;
|
||||
|
||||
// check if the PPS tree (starting from root) is complete
|
||||
if (isset($this->root) &&
|
||||
$this->_ppsTreeComplete($this->root->No)) {
|
||||
|
||||
if (isset($this->root) && $this->_ppsTreeComplete($this->root->No)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -473,8 +469,7 @@ class PHPExcel_Shared_OLE
|
||||
// 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));
|
||||
$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;
|
||||
|
||||
@ -513,7 +508,7 @@ class PHPExcel_Shared_OLE
|
||||
}
|
||||
|
||||
// factor used for separating numbers into 4 bytes parts
|
||||
$factor = pow(2,32);
|
||||
$factor = pow(2, 32);
|
||||
list(, $high_part) = unpack('V', substr($string, 4, 4));
|
||||
list(, $low_part) = unpack('V', substr($string, 0, 4));
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -57,9 +57,10 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||
/**
|
||||
* Register wrapper
|
||||
*/
|
||||
public static function register() {
|
||||
@stream_wrapper_unregister("zip");
|
||||
@stream_wrapper_register("zip", __CLASS__);
|
||||
public static function register()
|
||||
{
|
||||
@stream_wrapper_unregister('zip');
|
||||
@stream_wrapper_register('zip', __CLASS__);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -71,7 +72,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||
* @param string &$openedPath absolute path of the opened stream (out parameter)
|
||||
* @return bool true on success
|
||||
*/
|
||||
public function stream_open($path, $mode, $options, &$opened_path) {
|
||||
public function stream_open($path, $mode, $options, &$opened_path)
|
||||
{
|
||||
// Check for mode
|
||||
if ($mode{0} != 'r') {
|
||||
throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.');
|
||||
@ -87,7 +89,7 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||
|
||||
$this->_fileNameInArchive = $url['fragment'];
|
||||
$this->_position = 0;
|
||||
$this->_data = $this->_archive->getFromName( $this->_fileNameInArchive );
|
||||
$this->_data = $this->_archive->getFromName($this->_fileNameInArchive);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -97,7 +99,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function statName() {
|
||||
public function statName()
|
||||
{
|
||||
return $this->_fileNameInArchive;
|
||||
}
|
||||
|
||||
@ -106,8 +109,9 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function url_stat() {
|
||||
return $this->statName( $this->_fileNameInArchive );
|
||||
public function url_stat()
|
||||
{
|
||||
return $this->statName($this->_fileNameInArchive);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,8 +119,9 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function stream_stat() {
|
||||
return $this->_archive->statName( $this->_fileNameInArchive );
|
||||
public function stream_stat()
|
||||
{
|
||||
return $this->_archive->statName($this->_fileNameInArchive);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,7 +130,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||
* @param int $count maximum number of bytes to read
|
||||
* @return string
|
||||
*/
|
||||
function stream_read($count) {
|
||||
function stream_read($count)
|
||||
{
|
||||
$ret = substr($this->_data, $this->_position, $count);
|
||||
$this->_position += strlen($ret);
|
||||
return $ret;
|
||||
@ -137,7 +143,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function stream_tell() {
|
||||
public function stream_tell()
|
||||
{
|
||||
return $this->_position;
|
||||
}
|
||||
|
||||
@ -146,7 +153,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_eof() {
|
||||
public function stream_eof()
|
||||
{
|
||||
return $this->_position >= strlen($this->_data);
|
||||
}
|
||||
|
||||
@ -157,7 +165,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||
* @param int $whence SEEK_SET, SEEK_CUR or SEEK_END
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_seek($offset, $whence) {
|
||||
public function stream_seek($offset, $whence)
|
||||
{
|
||||
switch ($whence) {
|
||||
case SEEK_SET:
|
||||
if ($offset < strlen($this->_data) && $offset >= 0) {
|
||||
@ -167,7 +176,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case SEEK_CUR:
|
||||
if ($offset >= 0) {
|
||||
$this->_position += $offset;
|
||||
@ -176,7 +184,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case SEEK_END:
|
||||
if (strlen($this->_data) + $offset >= 0) {
|
||||
$this->_position = strlen($this->_data) + $offset;
|
||||
@ -185,7 +192,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -210,7 +210,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
{
|
||||
if (is_array($pStyles)) {
|
||||
if ($this->isSupervisor) {
|
||||
|
||||
$pRange = $this->getSelectedCells();
|
||||
|
||||
// Uppercase coordinate
|
||||
@ -322,7 +321,7 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
|
||||
unset($regionStyles['borders']['inside']);
|
||||
|
||||
// what are the inner edges of the region when looking at the selection
|
||||
$innerEdges = array_diff( array('top', 'right', 'bottom', 'left'), $edges );
|
||||
$innerEdges = array_diff(array('top', 'right', 'bottom', 'left'), $edges);
|
||||
|
||||
// inner edges that are not touching the region should take the 'inside' border properties if they have been set
|
||||
foreach ($innerEdges as $innerEdge) {
|
||||
|
@ -240,21 +240,21 @@ class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_Write
|
||||
$objWriter->writeAttribute('name', $customProperty);
|
||||
|
||||
switch ($propertyType) {
|
||||
case 'i' :
|
||||
case 'i':
|
||||
$objWriter->writeElement('vt:i4', $propertyValue);
|
||||
break;
|
||||
case 'f' :
|
||||
case 'f':
|
||||
$objWriter->writeElement('vt:r8', $propertyValue);
|
||||
break;
|
||||
case 'b' :
|
||||
case 'b':
|
||||
$objWriter->writeElement('vt:bool', ($propertyValue) ? 'true' : 'false');
|
||||
break;
|
||||
case 'd' :
|
||||
case 'd':
|
||||
$objWriter->startElement('vt:filetime');
|
||||
$objWriter->writeRawData(date(DATE_W3C, $propertyValue));
|
||||
$objWriter->endElement();
|
||||
break;
|
||||
default :
|
||||
default:
|
||||
$objWriter->writeElement('vt:lpwstr', $propertyValue);
|
||||
break;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
||||
* @return string XML Output
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function writeDrawings(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE)
|
||||
public function writeDrawings(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = false)
|
||||
{
|
||||
// Create XML writer
|
||||
$objWriter = null;
|
||||
@ -62,26 +62,25 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
||||
$objWriter->writeAttribute('xmlns:xdr', 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing');
|
||||
$objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
|
||||
|
||||
// Loop through images and write drawings
|
||||
$i = 1;
|
||||
$iterator = $pWorksheet->getDrawingCollection()->getIterator();
|
||||
while ($iterator->valid()) {
|
||||
$this->_writeDrawing($objWriter, $iterator->current(), $i);
|
||||
// Loop through images and write drawings
|
||||
$i = 1;
|
||||
$iterator = $pWorksheet->getDrawingCollection()->getIterator();
|
||||
while ($iterator->valid()) {
|
||||
$this->_writeDrawing($objWriter, $iterator->current(), $i);
|
||||
|
||||
$iterator->next();
|
||||
++$i;
|
||||
}
|
||||
$iterator->next();
|
||||
++$i;
|
||||
}
|
||||
|
||||
if ($includeCharts) {
|
||||
$chartCount = $pWorksheet->getChartCount();
|
||||
// Loop through charts and write the chart position
|
||||
if ($chartCount > 0) {
|
||||
for ($c = 0; $c < $chartCount; ++$c) {
|
||||
$this->_writeChart($objWriter, $pWorksheet->getChartByIndex($c), $c+$i);
|
||||
}
|
||||
if ($includeCharts) {
|
||||
$chartCount = $pWorksheet->getChartCount();
|
||||
// Loop through charts and write the chart position
|
||||
if ($chartCount > 0) {
|
||||
for ($c = 0; $c < $chartCount; ++$c) {
|
||||
$this->_writeChart($objWriter, $pWorksheet->getChartByIndex($c), $c+$i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -174,81 +173,81 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
||||
if ($pRelationId >= 0) {
|
||||
// xdr:oneCellAnchor
|
||||
$objWriter->startElement('xdr:oneCellAnchor');
|
||||
// Image location
|
||||
$aCoordinates = PHPExcel_Cell::coordinateFromString($pDrawing->getCoordinates());
|
||||
$aCoordinates[0] = PHPExcel_Cell::columnIndexFromString($aCoordinates[0]);
|
||||
// Image location
|
||||
$aCoordinates = PHPExcel_Cell::coordinateFromString($pDrawing->getCoordinates());
|
||||
$aCoordinates[0] = PHPExcel_Cell::columnIndexFromString($aCoordinates[0]);
|
||||
|
||||
// xdr:from
|
||||
$objWriter->startElement('xdr:from');
|
||||
$objWriter->writeElement('xdr:col', $aCoordinates[0] - 1);
|
||||
$objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetX()));
|
||||
$objWriter->writeElement('xdr:row', $aCoordinates[1] - 1);
|
||||
$objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetY()));
|
||||
$objWriter->endElement();
|
||||
// xdr:from
|
||||
$objWriter->startElement('xdr:from');
|
||||
$objWriter->writeElement('xdr:col', $aCoordinates[0] - 1);
|
||||
$objWriter->writeElement('xdr:colOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetX()));
|
||||
$objWriter->writeElement('xdr:row', $aCoordinates[1] - 1);
|
||||
$objWriter->writeElement('xdr:rowOff', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getOffsetY()));
|
||||
$objWriter->endElement();
|
||||
|
||||
// xdr:ext
|
||||
$objWriter->startElement('xdr:ext');
|
||||
$objWriter->writeAttribute('cx', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getWidth()));
|
||||
$objWriter->writeAttribute('cy', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getHeight()));
|
||||
$objWriter->endElement();
|
||||
// xdr:ext
|
||||
$objWriter->startElement('xdr:ext');
|
||||
$objWriter->writeAttribute('cx', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getWidth()));
|
||||
$objWriter->writeAttribute('cy', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getHeight()));
|
||||
$objWriter->endElement();
|
||||
|
||||
// xdr:pic
|
||||
$objWriter->startElement('xdr:pic');
|
||||
// xdr:pic
|
||||
$objWriter->startElement('xdr:pic');
|
||||
|
||||
// xdr:nvPicPr
|
||||
$objWriter->startElement('xdr:nvPicPr');
|
||||
// xdr:nvPicPr
|
||||
$objWriter->startElement('xdr:nvPicPr');
|
||||
|
||||
// xdr:cNvPr
|
||||
$objWriter->startElement('xdr:cNvPr');
|
||||
$objWriter->writeAttribute('id', $pRelationId);
|
||||
$objWriter->writeAttribute('name', $pDrawing->getName());
|
||||
$objWriter->writeAttribute('descr', $pDrawing->getDescription());
|
||||
$objWriter->endElement();
|
||||
// xdr:cNvPr
|
||||
$objWriter->startElement('xdr:cNvPr');
|
||||
$objWriter->writeAttribute('id', $pRelationId);
|
||||
$objWriter->writeAttribute('name', $pDrawing->getName());
|
||||
$objWriter->writeAttribute('descr', $pDrawing->getDescription());
|
||||
$objWriter->endElement();
|
||||
|
||||
// xdr:cNvPicPr
|
||||
$objWriter->startElement('xdr:cNvPicPr');
|
||||
// xdr:cNvPicPr
|
||||
$objWriter->startElement('xdr:cNvPicPr');
|
||||
|
||||
// a:picLocks
|
||||
$objWriter->startElement('a:picLocks');
|
||||
$objWriter->writeAttribute('noChangeAspect', '1');
|
||||
$objWriter->endElement();
|
||||
// a:picLocks
|
||||
$objWriter->startElement('a:picLocks');
|
||||
$objWriter->writeAttribute('noChangeAspect', '1');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// xdr:blipFill
|
||||
$objWriter->startElement('xdr:blipFill');
|
||||
// xdr:blipFill
|
||||
$objWriter->startElement('xdr:blipFill');
|
||||
|
||||
// a:blip
|
||||
$objWriter->startElement('a:blip');
|
||||
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
|
||||
$objWriter->writeAttribute('r:embed', 'rId' . $pRelationId);
|
||||
$objWriter->endElement();
|
||||
// a:blip
|
||||
$objWriter->startElement('a:blip');
|
||||
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
|
||||
$objWriter->writeAttribute('r:embed', 'rId' . $pRelationId);
|
||||
$objWriter->endElement();
|
||||
|
||||
// a:stretch
|
||||
$objWriter->startElement('a:stretch');
|
||||
$objWriter->writeElement('a:fillRect', null);
|
||||
$objWriter->endElement();
|
||||
// a:stretch
|
||||
$objWriter->startElement('a:stretch');
|
||||
$objWriter->writeElement('a:fillRect', null);
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// xdr:spPr
|
||||
$objWriter->startElement('xdr:spPr');
|
||||
// xdr:spPr
|
||||
$objWriter->startElement('xdr:spPr');
|
||||
|
||||
// a:xfrm
|
||||
$objWriter->startElement('a:xfrm');
|
||||
$objWriter->writeAttribute('rot', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getRotation()));
|
||||
$objWriter->endElement();
|
||||
// a:xfrm
|
||||
$objWriter->startElement('a:xfrm');
|
||||
$objWriter->writeAttribute('rot', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getRotation()));
|
||||
$objWriter->endElement();
|
||||
|
||||
// a:prstGeom
|
||||
$objWriter->startElement('a:prstGeom');
|
||||
$objWriter->writeAttribute('prst', 'rect');
|
||||
// a:prstGeom
|
||||
$objWriter->startElement('a:prstGeom');
|
||||
$objWriter->writeAttribute('prst', 'rect');
|
||||
|
||||
// a:avLst
|
||||
$objWriter->writeElement('a:avLst', null);
|
||||
// a:avLst
|
||||
$objWriter->writeElement('a:avLst', null);
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// // a:solidFill
|
||||
// $objWriter->startElement('a:solidFill');
|
||||
@ -268,110 +267,110 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
||||
|
||||
// $objWriter->endElement();
|
||||
/*
|
||||
// a:ln
|
||||
$objWriter->startElement('a:ln');
|
||||
$objWriter->writeAttribute('w', '88900');
|
||||
$objWriter->writeAttribute('cap', 'sq');
|
||||
// a:ln
|
||||
$objWriter->startElement('a:ln');
|
||||
$objWriter->writeAttribute('w', '88900');
|
||||
$objWriter->writeAttribute('cap', 'sq');
|
||||
|
||||
// a:solidFill
|
||||
$objWriter->startElement('a:solidFill');
|
||||
// a:solidFill
|
||||
$objWriter->startElement('a:solidFill');
|
||||
|
||||
// a:srgbClr
|
||||
$objWriter->startElement('a:srgbClr');
|
||||
$objWriter->writeAttribute('val', 'FFFFFF');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
// a:miter
|
||||
$objWriter->startElement('a:miter');
|
||||
$objWriter->writeAttribute('lim', '800000');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
*/
|
||||
|
||||
if ($pDrawing->getShadow()->getVisible()) {
|
||||
// a:effectLst
|
||||
$objWriter->startElement('a:effectLst');
|
||||
|
||||
// a:outerShdw
|
||||
$objWriter->startElement('a:outerShdw');
|
||||
$objWriter->writeAttribute('blurRad', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius()));
|
||||
$objWriter->writeAttribute('dist', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance()));
|
||||
$objWriter->writeAttribute('dir', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getShadow()->getDirection()));
|
||||
$objWriter->writeAttribute('algn', $pDrawing->getShadow()->getAlignment());
|
||||
$objWriter->writeAttribute('rotWithShape', '0');
|
||||
|
||||
// a:srgbClr
|
||||
$objWriter->startElement('a:srgbClr');
|
||||
$objWriter->writeAttribute('val', $pDrawing->getShadow()->getColor()->getRGB());
|
||||
|
||||
// a:alpha
|
||||
$objWriter->startElement('a:alpha');
|
||||
$objWriter->writeAttribute('val', $pDrawing->getShadow()->getAlpha() * 1000);
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
/*
|
||||
|
||||
// a:scene3d
|
||||
$objWriter->startElement('a:scene3d');
|
||||
|
||||
// a:camera
|
||||
$objWriter->startElement('a:camera');
|
||||
$objWriter->writeAttribute('prst', 'orthographicFront');
|
||||
$objWriter->endElement();
|
||||
|
||||
// a:lightRig
|
||||
$objWriter->startElement('a:lightRig');
|
||||
$objWriter->writeAttribute('rig', 'twoPt');
|
||||
$objWriter->writeAttribute('dir', 't');
|
||||
|
||||
// a:rot
|
||||
$objWriter->startElement('a:rot');
|
||||
$objWriter->writeAttribute('lat', '0');
|
||||
$objWriter->writeAttribute('lon', '0');
|
||||
$objWriter->writeAttribute('rev', '0');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
*/
|
||||
/*
|
||||
// a:sp3d
|
||||
$objWriter->startElement('a:sp3d');
|
||||
|
||||
// a:bevelT
|
||||
$objWriter->startElement('a:bevelT');
|
||||
$objWriter->writeAttribute('w', '25400');
|
||||
$objWriter->writeAttribute('h', '19050');
|
||||
$objWriter->endElement();
|
||||
|
||||
// a:contourClr
|
||||
$objWriter->startElement('a:contourClr');
|
||||
|
||||
// a:srgbClr
|
||||
$objWriter->startElement('a:srgbClr');
|
||||
$objWriter->writeAttribute('val', 'FFFFFF');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
*/
|
||||
// a:srgbClr
|
||||
$objWriter->startElement('a:srgbClr');
|
||||
$objWriter->writeAttribute('val', 'FFFFFF');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
// xdr:clientData
|
||||
$objWriter->writeElement('xdr:clientData', null);
|
||||
// a:miter
|
||||
$objWriter->startElement('a:miter');
|
||||
$objWriter->writeAttribute('lim', '800000');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
*/
|
||||
|
||||
if ($pDrawing->getShadow()->getVisible()) {
|
||||
// a:effectLst
|
||||
$objWriter->startElement('a:effectLst');
|
||||
|
||||
// a:outerShdw
|
||||
$objWriter->startElement('a:outerShdw');
|
||||
$objWriter->writeAttribute('blurRad', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius()));
|
||||
$objWriter->writeAttribute('dist', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance()));
|
||||
$objWriter->writeAttribute('dir', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getShadow()->getDirection()));
|
||||
$objWriter->writeAttribute('algn', $pDrawing->getShadow()->getAlignment());
|
||||
$objWriter->writeAttribute('rotWithShape', '0');
|
||||
|
||||
// a:srgbClr
|
||||
$objWriter->startElement('a:srgbClr');
|
||||
$objWriter->writeAttribute('val', $pDrawing->getShadow()->getColor()->getRGB());
|
||||
|
||||
// a:alpha
|
||||
$objWriter->startElement('a:alpha');
|
||||
$objWriter->writeAttribute('val', $pDrawing->getShadow()->getAlpha() * 1000);
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
/*
|
||||
|
||||
// a:scene3d
|
||||
$objWriter->startElement('a:scene3d');
|
||||
|
||||
// a:camera
|
||||
$objWriter->startElement('a:camera');
|
||||
$objWriter->writeAttribute('prst', 'orthographicFront');
|
||||
$objWriter->endElement();
|
||||
|
||||
// a:lightRig
|
||||
$objWriter->startElement('a:lightRig');
|
||||
$objWriter->writeAttribute('rig', 'twoPt');
|
||||
$objWriter->writeAttribute('dir', 't');
|
||||
|
||||
// a:rot
|
||||
$objWriter->startElement('a:rot');
|
||||
$objWriter->writeAttribute('lat', '0');
|
||||
$objWriter->writeAttribute('lon', '0');
|
||||
$objWriter->writeAttribute('rev', '0');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
*/
|
||||
/*
|
||||
// a:sp3d
|
||||
$objWriter->startElement('a:sp3d');
|
||||
|
||||
// a:bevelT
|
||||
$objWriter->startElement('a:bevelT');
|
||||
$objWriter->writeAttribute('w', '25400');
|
||||
$objWriter->writeAttribute('h', '19050');
|
||||
$objWriter->endElement();
|
||||
|
||||
// a:contourClr
|
||||
$objWriter->startElement('a:contourClr');
|
||||
|
||||
// a:srgbClr
|
||||
$objWriter->startElement('a:srgbClr');
|
||||
$objWriter->writeAttribute('val', 'FFFFFF');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
*/
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
// xdr:clientData
|
||||
$objWriter->writeElement('xdr:clientData', null);
|
||||
|
||||
$objWriter->endElement();
|
||||
} else {
|
||||
@ -399,8 +398,8 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
||||
// XML header
|
||||
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||
|
||||
// Header/footer images
|
||||
$images = $pWorksheet->getHeaderFooter()->getImages();
|
||||
// Header/footer images
|
||||
$images = $pWorksheet->getHeaderFooter()->getImages();
|
||||
|
||||
// xml
|
||||
$objWriter->startElement('xml');
|
||||
@ -408,117 +407,117 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
||||
$objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
|
||||
$objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel');
|
||||
|
||||
// o:shapelayout
|
||||
$objWriter->startElement('o:shapelayout');
|
||||
$objWriter->writeAttribute('v:ext', 'edit');
|
||||
// o:shapelayout
|
||||
$objWriter->startElement('o:shapelayout');
|
||||
$objWriter->writeAttribute('v:ext', 'edit');
|
||||
|
||||
// o:idmap
|
||||
$objWriter->startElement('o:idmap');
|
||||
$objWriter->writeAttribute('v:ext', 'edit');
|
||||
$objWriter->writeAttribute('data', '1');
|
||||
$objWriter->endElement();
|
||||
// o:idmap
|
||||
$objWriter->startElement('o:idmap');
|
||||
$objWriter->writeAttribute('v:ext', 'edit');
|
||||
$objWriter->writeAttribute('data', '1');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:shapetype
|
||||
$objWriter->startElement('v:shapetype');
|
||||
$objWriter->writeAttribute('id', '_x0000_t75');
|
||||
$objWriter->writeAttribute('coordsize', '21600,21600');
|
||||
$objWriter->writeAttribute('o:spt', '75');
|
||||
$objWriter->writeAttribute('o:preferrelative', 't');
|
||||
$objWriter->writeAttribute('path', 'm@4@5l@4@11@9@11@9@5xe');
|
||||
$objWriter->writeAttribute('filled', 'f');
|
||||
$objWriter->writeAttribute('stroked', 'f');
|
||||
// v:shapetype
|
||||
$objWriter->startElement('v:shapetype');
|
||||
$objWriter->writeAttribute('id', '_x0000_t75');
|
||||
$objWriter->writeAttribute('coordsize', '21600,21600');
|
||||
$objWriter->writeAttribute('o:spt', '75');
|
||||
$objWriter->writeAttribute('o:preferrelative', 't');
|
||||
$objWriter->writeAttribute('path', 'm@4@5l@4@11@9@11@9@5xe');
|
||||
$objWriter->writeAttribute('filled', 'f');
|
||||
$objWriter->writeAttribute('stroked', 'f');
|
||||
|
||||
// v:stroke
|
||||
$objWriter->startElement('v:stroke');
|
||||
$objWriter->writeAttribute('joinstyle', 'miter');
|
||||
$objWriter->endElement();
|
||||
// v:stroke
|
||||
$objWriter->startElement('v:stroke');
|
||||
$objWriter->writeAttribute('joinstyle', 'miter');
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:formulas
|
||||
$objWriter->startElement('v:formulas');
|
||||
// v:formulas
|
||||
$objWriter->startElement('v:formulas');
|
||||
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'if lineDrawn pixelLineWidth 0');
|
||||
$objWriter->endElement();
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'if lineDrawn pixelLineWidth 0');
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'sum @0 1 0');
|
||||
$objWriter->endElement();
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'sum @0 1 0');
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'sum 0 0 @1');
|
||||
$objWriter->endElement();
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'sum 0 0 @1');
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'prod @2 1 2');
|
||||
$objWriter->endElement();
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'prod @2 1 2');
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'prod @3 21600 pixelWidth');
|
||||
$objWriter->endElement();
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'prod @3 21600 pixelWidth');
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'prod @3 21600 pixelHeight');
|
||||
$objWriter->endElement();
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'prod @3 21600 pixelHeight');
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'sum @0 0 1');
|
||||
$objWriter->endElement();
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'sum @0 0 1');
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'prod @6 1 2');
|
||||
$objWriter->endElement();
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'prod @6 1 2');
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'prod @7 21600 pixelWidth');
|
||||
$objWriter->endElement();
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'prod @7 21600 pixelWidth');
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'sum @8 21600 0');
|
||||
$objWriter->endElement();
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'sum @8 21600 0');
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'prod @7 21600 pixelHeight');
|
||||
$objWriter->endElement();
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'prod @7 21600 pixelHeight');
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'sum @10 21600 0');
|
||||
$objWriter->endElement();
|
||||
// v:f
|
||||
$objWriter->startElement('v:f');
|
||||
$objWriter->writeAttribute('eqn', 'sum @10 21600 0');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// v:path
|
||||
$objWriter->startElement('v:path');
|
||||
$objWriter->writeAttribute('o:extrusionok', 'f');
|
||||
$objWriter->writeAttribute('gradientshapeok', 't');
|
||||
$objWriter->writeAttribute('o:connecttype', 'rect');
|
||||
$objWriter->endElement();
|
||||
// v:path
|
||||
$objWriter->startElement('v:path');
|
||||
$objWriter->writeAttribute('o:extrusionok', 'f');
|
||||
$objWriter->writeAttribute('gradientshapeok', 't');
|
||||
$objWriter->writeAttribute('o:connecttype', 'rect');
|
||||
$objWriter->endElement();
|
||||
|
||||
// o:lock
|
||||
$objWriter->startElement('o:lock');
|
||||
$objWriter->writeAttribute('v:ext', 'edit');
|
||||
$objWriter->writeAttribute('aspectratio', 't');
|
||||
$objWriter->endElement();
|
||||
// o:lock
|
||||
$objWriter->startElement('o:lock');
|
||||
$objWriter->writeAttribute('v:ext', 'edit');
|
||||
$objWriter->writeAttribute('aspectratio', 't');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
// Loop through images
|
||||
foreach ($images as $key => $value) {
|
||||
$this->_writeVMLHeaderFooterImage($objWriter, $key, $value);
|
||||
}
|
||||
// Loop through images
|
||||
foreach ($images as $key => $value) {
|
||||
$this->_writeVMLHeaderFooterImage($objWriter, $key, $value);
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
@ -548,22 +547,22 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
||||
|
||||
// v:shape
|
||||
$objWriter->startElement('v:shape');
|
||||
$objWriter->writeAttribute('id', $pReference);
|
||||
$objWriter->writeAttribute('o:spid', '_x0000_s' . $id);
|
||||
$objWriter->writeAttribute('type', '#_x0000_t75');
|
||||
$objWriter->writeAttribute('style', "position:absolute;margin-left:{$marginLeft}px;margin-top:{$marginTop}px;width:{$width}px;height:{$height}px;z-index:1");
|
||||
$objWriter->writeAttribute('id', $pReference);
|
||||
$objWriter->writeAttribute('o:spid', '_x0000_s' . $id);
|
||||
$objWriter->writeAttribute('type', '#_x0000_t75');
|
||||
$objWriter->writeAttribute('style', "position:absolute;margin-left:{$marginLeft}px;margin-top:{$marginTop}px;width:{$width}px;height:{$height}px;z-index:1");
|
||||
|
||||
// v:imagedata
|
||||
$objWriter->startElement('v:imagedata');
|
||||
$objWriter->writeAttribute('o:relid', 'rId' . $pReference);
|
||||
$objWriter->writeAttribute('o:title', $pImage->getName());
|
||||
$objWriter->endElement();
|
||||
// v:imagedata
|
||||
$objWriter->startElement('v:imagedata');
|
||||
$objWriter->writeAttribute('o:relid', 'rId' . $pReference);
|
||||
$objWriter->writeAttribute('o:title', $pImage->getName());
|
||||
$objWriter->endElement();
|
||||
|
||||
// o:lock
|
||||
$objWriter->startElement('o:lock');
|
||||
$objWriter->writeAttribute('v:ext', 'edit');
|
||||
$objWriter->writeAttribute('rotation', 't');
|
||||
$objWriter->endElement();
|
||||
// o:lock
|
||||
$objWriter->startElement('o:lock');
|
||||
$objWriter->writeAttribute('v:ext', 'edit');
|
||||
$objWriter->writeAttribute('rotation', 't');
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
@ -259,10 +259,10 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||
// Underline
|
||||
$underlineType = $element->getFont()->getUnderline();
|
||||
switch ($underlineType) {
|
||||
case 'single' :
|
||||
case 'single':
|
||||
$underlineType = 'sng';
|
||||
break;
|
||||
case 'double' :
|
||||
case 'double':
|
||||
$underlineType = 'dbl';
|
||||
break;
|
||||
}
|
||||
@ -304,7 +304,8 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
||||
* @param array $stringTable Stringtable
|
||||
* @return array
|
||||
*/
|
||||
public function flipStringTable($stringTable = array()) {
|
||||
public function flipStringTable($stringTable = array())
|
||||
{
|
||||
// Return value
|
||||
$returnValue = array();
|
||||
|
||||
|
@ -210,102 +210,103 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
// sheetViews
|
||||
$objWriter->startElement('sheetViews');
|
||||
|
||||
// Sheet selected?
|
||||
$sheetSelected = false;
|
||||
if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex()) {
|
||||
$sheetSelected = true;
|
||||
// Sheet selected?
|
||||
$sheetSelected = false;
|
||||
if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex()) {
|
||||
$sheetSelected = true;
|
||||
}
|
||||
|
||||
// sheetView
|
||||
$objWriter->startElement('sheetView');
|
||||
$objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0');
|
||||
$objWriter->writeAttribute('workbookViewId', '0');
|
||||
|
||||
// Zoom scales
|
||||
if ($pSheet->getSheetView()->getZoomScale() != 100) {
|
||||
$objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale());
|
||||
}
|
||||
if ($pSheet->getSheetView()->getZoomScaleNormal() != 100) {
|
||||
$objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal());
|
||||
}
|
||||
|
||||
// View Layout Type
|
||||
if ($pSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL) {
|
||||
$objWriter->writeAttribute('view', $pSheet->getSheetView()->getView());
|
||||
}
|
||||
|
||||
// Gridlines
|
||||
if ($pSheet->getShowGridlines()) {
|
||||
$objWriter->writeAttribute('showGridLines', 'true');
|
||||
} else {
|
||||
$objWriter->writeAttribute('showGridLines', 'false');
|
||||
}
|
||||
|
||||
// Row and column headers
|
||||
if ($pSheet->getShowRowColHeaders()) {
|
||||
$objWriter->writeAttribute('showRowColHeaders', '1');
|
||||
} else {
|
||||
$objWriter->writeAttribute('showRowColHeaders', '0');
|
||||
}
|
||||
|
||||
// Right-to-left
|
||||
if ($pSheet->getRightToLeft()) {
|
||||
$objWriter->writeAttribute('rightToLeft', 'true');
|
||||
}
|
||||
|
||||
$activeCell = $pSheet->getActiveCell();
|
||||
|
||||
// Pane
|
||||
$pane = '';
|
||||
$topLeftCell = $pSheet->getFreezePane();
|
||||
if (($topLeftCell != '') && ($topLeftCell != 'A1')) {
|
||||
$activeCell = $topLeftCell;
|
||||
// Calculate freeze coordinates
|
||||
$xSplit = $ySplit = 0;
|
||||
|
||||
list($xSplit, $ySplit) = PHPExcel_Cell::coordinateFromString($topLeftCell);
|
||||
$xSplit = PHPExcel_Cell::columnIndexFromString($xSplit);
|
||||
|
||||
// pane
|
||||
$pane = 'topRight';
|
||||
$objWriter->startElement('pane');
|
||||
if ($xSplit > 1) {
|
||||
$objWriter->writeAttribute('xSplit', $xSplit - 1);
|
||||
}
|
||||
|
||||
// sheetView
|
||||
$objWriter->startElement('sheetView');
|
||||
$objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0');
|
||||
$objWriter->writeAttribute('workbookViewId', '0');
|
||||
|
||||
// Zoom scales
|
||||
if ($pSheet->getSheetView()->getZoomScale() != 100) {
|
||||
$objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale());
|
||||
}
|
||||
if ($pSheet->getSheetView()->getZoomScaleNormal() != 100) {
|
||||
$objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal());
|
||||
}
|
||||
|
||||
// View Layout Type
|
||||
if ($pSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL) {
|
||||
$objWriter->writeAttribute('view', $pSheet->getSheetView()->getView());
|
||||
}
|
||||
|
||||
// Gridlines
|
||||
if ($pSheet->getShowGridlines()) {
|
||||
$objWriter->writeAttribute('showGridLines', 'true');
|
||||
} else {
|
||||
$objWriter->writeAttribute('showGridLines', 'false');
|
||||
}
|
||||
|
||||
// Row and column headers
|
||||
if ($pSheet->getShowRowColHeaders()) {
|
||||
$objWriter->writeAttribute('showRowColHeaders', '1');
|
||||
} else {
|
||||
$objWriter->writeAttribute('showRowColHeaders', '0');
|
||||
}
|
||||
|
||||
// Right-to-left
|
||||
if ($pSheet->getRightToLeft()) {
|
||||
$objWriter->writeAttribute('rightToLeft', 'true');
|
||||
}
|
||||
|
||||
$activeCell = $pSheet->getActiveCell();
|
||||
|
||||
// Pane
|
||||
$pane = '';
|
||||
$topLeftCell = $pSheet->getFreezePane();
|
||||
if (($topLeftCell != '') && ($topLeftCell != 'A1')) {
|
||||
$activeCell = $topLeftCell;
|
||||
// Calculate freeze coordinates
|
||||
$xSplit = $ySplit = 0;
|
||||
|
||||
list($xSplit, $ySplit) = PHPExcel_Cell::coordinateFromString($topLeftCell);
|
||||
$xSplit = PHPExcel_Cell::columnIndexFromString($xSplit);
|
||||
|
||||
// pane
|
||||
$pane = 'topRight';
|
||||
$objWriter->startElement('pane');
|
||||
if ($xSplit > 1)
|
||||
$objWriter->writeAttribute('xSplit', $xSplit - 1);
|
||||
if ($ySplit > 1) {
|
||||
$objWriter->writeAttribute('ySplit', $ySplit - 1);
|
||||
$pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft';
|
||||
}
|
||||
$objWriter->writeAttribute('topLeftCell', $topLeftCell);
|
||||
$objWriter->writeAttribute('activePane', $pane);
|
||||
$objWriter->writeAttribute('state', 'frozen');
|
||||
$objWriter->endElement();
|
||||
|
||||
if (($xSplit > 1) && ($ySplit > 1)) {
|
||||
// Write additional selections if more than two panes (ie both an X and a Y split)
|
||||
$objWriter->startElement('selection');
|
||||
$objWriter->writeAttribute('pane', 'topRight');
|
||||
$objWriter->endElement();
|
||||
$objWriter->startElement('selection');
|
||||
$objWriter->writeAttribute('pane', 'bottomLeft');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
// Selection
|
||||
// if ($pane != '') {
|
||||
// Only need to write selection element if we have a split pane
|
||||
// We cheat a little by over-riding the active cell selection, setting it to the split cell
|
||||
$objWriter->startElement('selection');
|
||||
if ($pane != '') {
|
||||
$objWriter->writeAttribute('pane', $pane);
|
||||
}
|
||||
$objWriter->writeAttribute('activeCell', $activeCell);
|
||||
$objWriter->writeAttribute('sqref', $activeCell);
|
||||
$objWriter->endElement();
|
||||
// }
|
||||
|
||||
if ($ySplit > 1) {
|
||||
$objWriter->writeAttribute('ySplit', $ySplit - 1);
|
||||
$pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft';
|
||||
}
|
||||
$objWriter->writeAttribute('topLeftCell', $topLeftCell);
|
||||
$objWriter->writeAttribute('activePane', $pane);
|
||||
$objWriter->writeAttribute('state', 'frozen');
|
||||
$objWriter->endElement();
|
||||
|
||||
if (($xSplit > 1) && ($ySplit > 1)) {
|
||||
// Write additional selections if more than two panes (ie both an X and a Y split)
|
||||
$objWriter->startElement('selection');
|
||||
$objWriter->writeAttribute('pane', 'topRight');
|
||||
$objWriter->endElement();
|
||||
$objWriter->startElement('selection');
|
||||
$objWriter->writeAttribute('pane', 'bottomLeft');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
// Selection
|
||||
// if ($pane != '') {
|
||||
// Only need to write selection element if we have a split pane
|
||||
// We cheat a little by over-riding the active cell selection, setting it to the split cell
|
||||
$objWriter->startElement('selection');
|
||||
if ($pane != '') {
|
||||
$objWriter->writeAttribute('pane', $pane);
|
||||
}
|
||||
$objWriter->writeAttribute('activeCell', $activeCell);
|
||||
$objWriter->writeAttribute('sqref', $activeCell);
|
||||
$objWriter->endElement();
|
||||
// }
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
@ -371,7 +372,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
|
||||
{
|
||||
// cols
|
||||
if (count($pSheet->getColumnDimensions()) > 0) {
|
||||
if (count($pSheet->getColumnDimensions()) > 0) {
|
||||
$objWriter->startElement('cols');
|
||||
|
||||
$pSheet->calculateColumnWidths();
|
||||
@ -485,50 +486,48 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
$objWriter->startElement('conditionalFormatting');
|
||||
$objWriter->writeAttribute('sqref', $cellCoordinate);
|
||||
|
||||
// cfRule
|
||||
$objWriter->startElement('cfRule');
|
||||
$objWriter->writeAttribute('type', $conditional->getConditionType());
|
||||
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()));
|
||||
$objWriter->writeAttribute('priority', $id++);
|
||||
// cfRule
|
||||
$objWriter->startElement('cfRule');
|
||||
$objWriter->writeAttribute('type', $conditional->getConditionType());
|
||||
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()));
|
||||
$objWriter->writeAttribute('priority', $id++);
|
||||
|
||||
if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
|
||||
||
|
||||
$conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
|
||||
&& $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) {
|
||||
$objWriter->writeAttribute('operator', $conditional->getOperatorType());
|
||||
if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
|
||||
&& $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) {
|
||||
$objWriter->writeAttribute('operator', $conditional->getOperatorType());
|
||||
}
|
||||
|
||||
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeAttribute('text', $conditional->getText());
|
||||
}
|
||||
|
||||
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))');
|
||||
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
|
||||
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
|
||||
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))');
|
||||
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
|
||||
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
|
||||
foreach ($conditional->getConditions() as $formula) {
|
||||
// Formula
|
||||
$objWriter->writeElement('formula', $formula);
|
||||
}
|
||||
}
|
||||
|
||||
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeAttribute('text', $conditional->getText());
|
||||
}
|
||||
|
||||
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))');
|
||||
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
|
||||
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
|
||||
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS
|
||||
&& !is_null($conditional->getText())) {
|
||||
$objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))');
|
||||
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
|
||||
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|
||||
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
|
||||
foreach ($conditional->getConditions() as $formula) {
|
||||
// Formula
|
||||
$objWriter->writeElement('formula', $formula);
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -656,17 +655,17 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
// protectedRanges
|
||||
$objWriter->startElement('protectedRanges');
|
||||
|
||||
// Loop protectedRanges
|
||||
foreach ($pSheet->getProtectedCells() as $protectedCell => $passwordHash) {
|
||||
// protectedRange
|
||||
$objWriter->startElement('protectedRange');
|
||||
$objWriter->writeAttribute('name', 'p' . md5($protectedCell));
|
||||
$objWriter->writeAttribute('sqref', $protectedCell);
|
||||
if (!empty($passwordHash)) {
|
||||
$objWriter->writeAttribute('password', $passwordHash);
|
||||
}
|
||||
$objWriter->endElement();
|
||||
// Loop protectedRanges
|
||||
foreach ($pSheet->getProtectedCells() as $protectedCell => $passwordHash) {
|
||||
// protectedRange
|
||||
$objWriter->startElement('protectedRange');
|
||||
$objWriter->writeAttribute('name', 'p' . md5($protectedCell));
|
||||
$objWriter->writeAttribute('sqref', $protectedCell);
|
||||
if (!empty($passwordHash)) {
|
||||
$objWriter->writeAttribute('password', $passwordHash);
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -685,13 +684,13 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
// mergeCells
|
||||
$objWriter->startElement('mergeCells');
|
||||
|
||||
// Loop mergeCells
|
||||
foreach ($pSheet->getMergeCells() as $mergeCell) {
|
||||
// mergeCell
|
||||
$objWriter->startElement('mergeCell');
|
||||
$objWriter->writeAttribute('ref', $mergeCell);
|
||||
$objWriter->endElement();
|
||||
}
|
||||
// Loop mergeCells
|
||||
foreach ($pSheet->getMergeCells() as $mergeCell) {
|
||||
// mergeCell
|
||||
$objWriter->startElement('mergeCell');
|
||||
$objWriter->writeAttribute('ref', $mergeCell);
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -766,71 +765,70 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
}
|
||||
$range = implode(':', $range);
|
||||
|
||||
$objWriter->writeAttribute('ref', str_replace('$','', $range));
|
||||
$objWriter->writeAttribute('ref', str_replace('$', '', $range));
|
||||
|
||||
$columns = $pSheet->getAutoFilter()->getColumns();
|
||||
if (count($columns > 0)) {
|
||||
foreach ($columns as $columnID => $column) {
|
||||
$rules = $column->getRules();
|
||||
if (count($rules > 0)) {
|
||||
if (count($rules) > 0) {
|
||||
$objWriter->startElement('filterColumn');
|
||||
$objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
|
||||
$objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
|
||||
|
||||
$objWriter->startElement($column->getFilterType());
|
||||
if ($column->getJoin() == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND) {
|
||||
$objWriter->writeAttribute('and', 1);
|
||||
$objWriter->startElement($column->getFilterType());
|
||||
if ($column->getJoin() == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND) {
|
||||
$objWriter->writeAttribute('and', 1);
|
||||
}
|
||||
|
||||
foreach ($rules as $rule) {
|
||||
if (($column->getFilterType() === PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER) &&
|
||||
($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) &&
|
||||
($rule->getValue() === '')) {
|
||||
// Filter rule for Blanks
|
||||
$objWriter->writeAttribute('blank', 1);
|
||||
} elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) {
|
||||
// Dynamic Filter Rule
|
||||
$objWriter->writeAttribute('type', $rule->getGrouping());
|
||||
$val = $column->getAttribute('val');
|
||||
if ($val !== null) {
|
||||
$objWriter->writeAttribute('val', $val);
|
||||
}
|
||||
$maxVal = $column->getAttribute('maxVal');
|
||||
if ($maxVal !== null) {
|
||||
$objWriter->writeAttribute('maxVal', $maxVal);
|
||||
}
|
||||
} elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) {
|
||||
// Top 10 Filter Rule
|
||||
$objWriter->writeAttribute('val', $rule->getValue());
|
||||
$objWriter->writeAttribute('percent', (($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0'));
|
||||
$objWriter->writeAttribute('top', (($rule->getGrouping() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0'));
|
||||
} else {
|
||||
// Filter, DateGroupItem or CustomFilter
|
||||
$objWriter->startElement($rule->getRuleType());
|
||||
|
||||
foreach ($rules as $rule) {
|
||||
if (($column->getFilterType() === PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER) &&
|
||||
($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) &&
|
||||
($rule->getValue() === '')) {
|
||||
// Filter rule for Blanks
|
||||
$objWriter->writeAttribute('blank', 1);
|
||||
} elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) {
|
||||
// Dynamic Filter Rule
|
||||
$objWriter->writeAttribute('type', $rule->getGrouping());
|
||||
$val = $column->getAttribute('val');
|
||||
if ($val !== null) {
|
||||
$objWriter->writeAttribute('val', $val);
|
||||
}
|
||||
$maxVal = $column->getAttribute('maxVal');
|
||||
if ($maxVal !== null) {
|
||||
$objWriter->writeAttribute('maxVal', $maxVal);
|
||||
}
|
||||
} elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) {
|
||||
// Top 10 Filter Rule
|
||||
$objWriter->writeAttribute('val', $rule->getValue());
|
||||
$objWriter->writeAttribute('percent', (($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0'));
|
||||
$objWriter->writeAttribute('top', (($rule->getGrouping() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0'));
|
||||
} else {
|
||||
// Filter, DateGroupItem or CustomFilter
|
||||
$objWriter->startElement($rule->getRuleType());
|
||||
|
||||
if ($rule->getOperator() !== PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) {
|
||||
$objWriter->writeAttribute('operator', $rule->getOperator());
|
||||
}
|
||||
if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
|
||||
// Date Group filters
|
||||
foreach ($rule->getValue() as $key => $value) {
|
||||
if ($value > '') $objWriter->writeAttribute($key, $value);
|
||||
}
|
||||
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
|
||||
} else {
|
||||
$objWriter->writeAttribute('val', $rule->getValue());
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
if ($rule->getOperator() !== PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) {
|
||||
$objWriter->writeAttribute('operator', $rule->getOperator());
|
||||
}
|
||||
if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
|
||||
// Date Group filters
|
||||
foreach ($rule->getValue() as $key => $value) {
|
||||
if ($value > '') $objWriter->writeAttribute($key, $value);
|
||||
}
|
||||
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
|
||||
} else {
|
||||
$objWriter->writeAttribute('val', $rule->getValue());
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
@ -921,14 +919,14 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
$objWriter->writeAttribute('count', count($aRowBreaks));
|
||||
$objWriter->writeAttribute('manualBreakCount', count($aRowBreaks));
|
||||
|
||||
foreach ($aRowBreaks as $cell) {
|
||||
$coords = PHPExcel_Cell::coordinateFromString($cell);
|
||||
foreach ($aRowBreaks as $cell) {
|
||||
$coords = PHPExcel_Cell::coordinateFromString($cell);
|
||||
|
||||
$objWriter->startElement('brk');
|
||||
$objWriter->writeAttribute('id', $coords[1]);
|
||||
$objWriter->writeAttribute('man', '1');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
$objWriter->startElement('brk');
|
||||
$objWriter->writeAttribute('id', $coords[1]);
|
||||
$objWriter->writeAttribute('man', '1');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -939,14 +937,14 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
||||
$objWriter->writeAttribute('count', count($aColumnBreaks));
|
||||
$objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks));
|
||||
|
||||
foreach ($aColumnBreaks as $cell) {
|
||||
$coords = PHPExcel_Cell::coordinateFromString($cell);
|
||||
foreach ($aColumnBreaks as $cell) {
|
||||
$coords = PHPExcel_Cell::coordinateFromString($cell);
|
||||
|
||||
$objWriter->startElement('brk');
|
||||
$objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1);
|
||||
$objWriter->writeAttribute('man', '1');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
$objWriter->startElement('brk');
|
||||
$objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1);
|
||||
$objWriter->writeAttribute('man', '1');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
@ -1135,8 +1135,7 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
} 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 != '.')) {
|
||||
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
|
||||
return $token;
|
||||
}
|
||||
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 != '.')) {
|
||||
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
|
||||
return $token;
|
||||
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) && !preg_match("/[0-9]/", $this->_lookahead)) {
|
||||
@ -1253,7 +1252,7 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
$this->_advance();
|
||||
return $result;
|
||||
// If it's an error code
|
||||
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $this->_current_token) or $this->_current_token == '#N/A'){
|
||||
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $this->_current_token) or $this->_current_token == '#N/A') {
|
||||
$result = $this->_createTree($this->_current_token, 'ptgErr', '');
|
||||
$this->_advance();
|
||||
return $result;
|
||||
@ -1361,45 +1360,39 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
$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)) {
|
||||
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
|
||||
$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)) {
|
||||
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
|
||||
$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
|
||||
} 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)) {
|
||||
// if it's a range A1:B2 or $A$1:$B$2
|
||||
// must be an error?
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
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)) {
|
||||
// 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)
|
||||
// must be an error?
|
||||
//$result = $this->_current_token;
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
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)) {
|
||||
// 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)
|
||||
// must be an error?
|
||||
//$result = $this->_current_token;
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
return $result;
|
||||
}
|
||||
// If it's a number or a percent
|
||||
elseif (is_numeric($this->_current_token)) {
|
||||
} elseif (is_numeric($this->_current_token)) {
|
||||
// If it's a number or a percent
|
||||
if ($this->_lookahead == '%') {
|
||||
$result = $this->_createTree('ptgPercent', $this->_current_token, '');
|
||||
$this->_advance(); // Skip the percentage operator once we've pre-built that tree
|
||||
@ -1408,15 +1401,12 @@ class PHPExcel_Writer_Excel5_Parser
|
||||
}
|
||||
$this->_advance();
|
||||
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)) {
|
||||
// if it's a function call
|
||||
$result = $this->_func();
|
||||
return $result;
|
||||
}
|
||||
throw new PHPExcel_Writer_Exception("Syntax error: ".$this->_current_token.
|
||||
", lookahead: ".$this->_lookahead.
|
||||
", current char: ".$this->_current_char);
|
||||
throw new PHPExcel_Writer_Exception("Syntax error: ".$this->_current_token.", lookahead: ".$this->_lookahead.", current char: ".$this->_current_char);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user