PSR2 Fixes
This commit is contained in:
parent
4c8dd00dff
commit
1bf5ea414b
|
@ -752,16 +752,19 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||||
switch ($chartType) {
|
switch ($chartType) {
|
||||||
case 'area3DChart':
|
case 'area3DChart':
|
||||||
$dimensions = '3d';
|
$dimensions = '3d';
|
||||||
|
// no break
|
||||||
case 'areaChart':
|
case 'areaChart':
|
||||||
$this->renderPlotLine($i, true, true, $dimensions);
|
$this->renderPlotLine($i, true, true, $dimensions);
|
||||||
break;
|
break;
|
||||||
case 'bar3DChart':
|
case 'bar3DChart':
|
||||||
$dimensions = '3d';
|
$dimensions = '3d';
|
||||||
|
// no break
|
||||||
case 'barChart':
|
case 'barChart':
|
||||||
$this->renderPlotBar($i, $dimensions);
|
$this->renderPlotBar($i, $dimensions);
|
||||||
break;
|
break;
|
||||||
case 'line3DChart':
|
case 'line3DChart':
|
||||||
$dimensions = '3d';
|
$dimensions = '3d';
|
||||||
|
// no break
|
||||||
case 'lineChart':
|
case 'lineChart':
|
||||||
$this->renderPlotLine($i, false, true, $dimensions);
|
$this->renderPlotLine($i, false, true, $dimensions);
|
||||||
break;
|
break;
|
||||||
|
@ -812,26 +815,31 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||||
switch ($chartType) {
|
switch ($chartType) {
|
||||||
case 'area3DChart':
|
case 'area3DChart':
|
||||||
$dimensions = '3d';
|
$dimensions = '3d';
|
||||||
|
// no break
|
||||||
case 'areaChart':
|
case 'areaChart':
|
||||||
$this->renderAreaChart($groupCount, $dimensions);
|
$this->renderAreaChart($groupCount, $dimensions);
|
||||||
break;
|
break;
|
||||||
case 'bar3DChart':
|
case 'bar3DChart':
|
||||||
$dimensions = '3d';
|
$dimensions = '3d';
|
||||||
|
// no break
|
||||||
case 'barChart':
|
case 'barChart':
|
||||||
$this->renderBarChart($groupCount, $dimensions);
|
$this->renderBarChart($groupCount, $dimensions);
|
||||||
break;
|
break;
|
||||||
case 'line3DChart':
|
case 'line3DChart':
|
||||||
$dimensions = '3d';
|
$dimensions = '3d';
|
||||||
|
// no break
|
||||||
case 'lineChart':
|
case 'lineChart':
|
||||||
$this->renderLineChart($groupCount, $dimensions);
|
$this->renderLineChart($groupCount, $dimensions);
|
||||||
break;
|
break;
|
||||||
case 'pie3DChart':
|
case 'pie3DChart':
|
||||||
$dimensions = '3d';
|
$dimensions = '3d';
|
||||||
|
// no break
|
||||||
case 'pieChart':
|
case 'pieChart':
|
||||||
$this->renderPieChart($groupCount, $dimensions, false, false);
|
$this->renderPieChart($groupCount, $dimensions, false, false);
|
||||||
break;
|
break;
|
||||||
case 'doughnut3DChart':
|
case 'doughnut3DChart':
|
||||||
$dimensions = '3d';
|
$dimensions = '3d';
|
||||||
|
// no break
|
||||||
case 'doughnutChart':
|
case 'doughnutChart':
|
||||||
$this->renderPieChart($groupCount, $dimensions, true, true);
|
$this->renderPieChart($groupCount, $dimensions, true, true);
|
||||||
break;
|
break;
|
||||||
|
@ -846,6 +854,7 @@ class PHPExcel_Chart_Renderer_jpgraph
|
||||||
break;
|
break;
|
||||||
case 'surface3DChart':
|
case 'surface3DChart':
|
||||||
$dimensions = '3d';
|
$dimensions = '3d';
|
||||||
|
// no break
|
||||||
case 'surfaceChart':
|
case 'surfaceChart':
|
||||||
$this->renderContourChart($groupCount, $dimensions);
|
$this->renderContourChart($groupCount, $dimensions);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -573,7 +573,8 @@ class PHPExcel_Helper_HTML
|
||||||
|
|
||||||
protected $richTextObject;
|
protected $richTextObject;
|
||||||
|
|
||||||
protected function initialise() {
|
protected function initialise()
|
||||||
|
{
|
||||||
$this->face = $this->size = $this->color = null;
|
$this->face = $this->size = $this->color = null;
|
||||||
$this->bold = $this->italic = $this->underline = $this->superscript = $this->subscript = $this->strikethrough = false;
|
$this->bold = $this->italic = $this->underline = $this->superscript = $this->subscript = $this->strikethrough = false;
|
||||||
|
|
||||||
|
@ -582,7 +583,8 @@ class PHPExcel_Helper_HTML
|
||||||
$this->stringData = '';
|
$this->stringData = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toRichTextObject($html) {
|
public function toRichTextObject($html)
|
||||||
|
{
|
||||||
$this->initialise();
|
$this->initialise();
|
||||||
|
|
||||||
// Create a new DOM object
|
// Create a new DOM object
|
||||||
|
@ -594,15 +596,17 @@ class PHPExcel_Helper_HTML
|
||||||
// Discard excess white space
|
// Discard excess white space
|
||||||
$dom->preserveWhiteSpace = false;
|
$dom->preserveWhiteSpace = false;
|
||||||
|
|
||||||
$this->richTextObject = new PHPExcel_RichText();;
|
$this->richTextObject = new PHPExcel_RichText();
|
||||||
$this->parseElements($dom);
|
$this->parseElements($dom);
|
||||||
return $this->richTextObject;
|
return $this->richTextObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildTextRun() {
|
protected function buildTextRun()
|
||||||
|
{
|
||||||
$text = $this->stringData;
|
$text = $this->stringData;
|
||||||
if (trim($text) === '')
|
if (trim($text) === '') {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$richtextRun = $this->richTextObject->createTextRun($this->stringData);
|
$richtextRun = $this->richTextObject->createTextRun($this->stringData);
|
||||||
if ($this->face) {
|
if ($this->face) {
|
||||||
|
@ -635,7 +639,8 @@ class PHPExcel_Helper_HTML
|
||||||
$this->stringData = '';
|
$this->stringData = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function rgbToColour($rgb) {
|
protected function rgbToColour($rgb)
|
||||||
|
{
|
||||||
preg_match_all('/\d+/', $rgb, $values);
|
preg_match_all('/\d+/', $rgb, $values);
|
||||||
foreach ($values[0] as &$value) {
|
foreach ($values[0] as &$value) {
|
||||||
$value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT);
|
$value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT);
|
||||||
|
@ -643,11 +648,13 @@ class PHPExcel_Helper_HTML
|
||||||
return implode($values[0]);
|
return implode($values[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function colourNameLookup($rgb) {
|
protected function colourNameLookup($rgb)
|
||||||
|
{
|
||||||
return self::$colourMap[$rgb];
|
return self::$colourMap[$rgb];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function startFontTag($tag) {
|
protected function startFontTag($tag)
|
||||||
|
{
|
||||||
foreach ($tag->attributes as $attribute) {
|
foreach ($tag->attributes as $attribute) {
|
||||||
$attributeName = strtolower($attribute->name);
|
$attributeName = strtolower($attribute->name);
|
||||||
$attributeValue = $attribute->value;
|
$attributeValue = $attribute->value;
|
||||||
|
@ -666,69 +673,85 @@ class PHPExcel_Helper_HTML
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function endFontTag() {
|
protected function endFontTag()
|
||||||
|
{
|
||||||
$this->face = $this->size = $this->color = null;
|
$this->face = $this->size = $this->color = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function startBoldTag() {
|
protected function startBoldTag()
|
||||||
|
{
|
||||||
$this->bold = true;
|
$this->bold = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function endBoldTag() {
|
protected function endBoldTag()
|
||||||
|
{
|
||||||
$this->bold = false;
|
$this->bold = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function startItalicTag() {
|
protected function startItalicTag()
|
||||||
|
{
|
||||||
$this->italic = true;
|
$this->italic = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function endItalicTag() {
|
protected function endItalicTag()
|
||||||
|
{
|
||||||
$this->italic = false;
|
$this->italic = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function startUnderlineTag() {
|
protected function startUnderlineTag()
|
||||||
|
{
|
||||||
$this->underline = true;
|
$this->underline = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function endUnderlineTag() {
|
protected function endUnderlineTag()
|
||||||
|
{
|
||||||
$this->underline = false;
|
$this->underline = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function startSubscriptTag() {
|
protected function startSubscriptTag()
|
||||||
|
{
|
||||||
$this->subscript = true;
|
$this->subscript = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function endSubscriptTag() {
|
protected function endSubscriptTag()
|
||||||
|
{
|
||||||
$this->subscript = false;
|
$this->subscript = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function startSuperscriptTag() {
|
protected function startSuperscriptTag()
|
||||||
|
{
|
||||||
$this->superscript = true;
|
$this->superscript = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function endSuperscriptTag() {
|
protected function endSuperscriptTag()
|
||||||
|
{
|
||||||
$this->superscript = false;
|
$this->superscript = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function startStrikethruTag() {
|
protected function startStrikethruTag()
|
||||||
|
{
|
||||||
$this->strikethrough = true;
|
$this->strikethrough = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function endStrikethruTag() {
|
protected function endStrikethruTag()
|
||||||
|
{
|
||||||
$this->strikethrough = false;
|
$this->strikethrough = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function breakTag() {
|
protected function breakTag()
|
||||||
|
{
|
||||||
$this->stringData .= PHP_EOL;
|
$this->stringData .= PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function parseTextNode(DOMText $textNode) {
|
protected function parseTextNode(DOMText $textNode)
|
||||||
|
{
|
||||||
$domText = preg_replace('/\s+/u', ' ', ltrim($textNode->nodeValue));
|
$domText = preg_replace('/\s+/u', ' ', ltrim($textNode->nodeValue));
|
||||||
$this->stringData .= $domText;
|
$this->stringData .= $domText;
|
||||||
$this->buildTextRun();
|
$this->buildTextRun();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function handleCallback($element, $callbackTag, $callbacks) {
|
protected function handleCallback($element, $callbackTag, $callbacks)
|
||||||
|
{
|
||||||
if (isset($callbacks[$callbackTag])) {
|
if (isset($callbacks[$callbackTag])) {
|
||||||
$elementHandler = $callbacks[$callbackTag];
|
$elementHandler = $callbacks[$callbackTag];
|
||||||
if (method_exists($this, $elementHandler)) {
|
if (method_exists($this, $elementHandler)) {
|
||||||
|
@ -737,7 +760,8 @@ class PHPExcel_Helper_HTML
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function parseElementNode(DOMElement $element) {
|
protected function parseElementNode(DOMElement $element)
|
||||||
|
{
|
||||||
$callbackTag = strtolower($element->nodeName);
|
$callbackTag = strtolower($element->nodeName);
|
||||||
$this->stack[] = $callbackTag;
|
$this->stack[] = $callbackTag;
|
||||||
|
|
||||||
|
@ -750,7 +774,8 @@ class PHPExcel_Helper_HTML
|
||||||
$this->handleCallback($element, $callbackTag, $this->endTagCallbacks);
|
$this->handleCallback($element, $callbackTag, $this->endTagCallbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function parseElements(DOMNode $element) {
|
protected function parseElements(DOMNode $element)
|
||||||
|
{
|
||||||
foreach ($element->childNodes as $child) {
|
foreach ($element->childNodes as $child) {
|
||||||
if ($child instanceof DOMText) {
|
if ($child instanceof DOMText) {
|
||||||
$this->parseTextNode($child);
|
$this->parseTextNode($child);
|
||||||
|
|
|
@ -42,7 +42,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
protected $_readDataOnly = FALSE;
|
protected $_readDataOnly = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read charts that are defined in the workbook?
|
* Read charts that are defined in the workbook?
|
||||||
|
@ -50,7 +50,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
*
|
*
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
protected $_includeCharts = FALSE;
|
protected $_includeCharts = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restrict which sheets should be loaded?
|
* Restrict which sheets should be loaded?
|
||||||
|
@ -58,16 +58,16 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
*
|
*
|
||||||
* @var array of string
|
* @var array of string
|
||||||
*/
|
*/
|
||||||
protected $_loadSheetsOnly = NULL;
|
protected $_loadSheetsOnly = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Reader_IReadFilter instance
|
* PHPExcel_Reader_IReadFilter instance
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Reader_IReadFilter
|
* @var PHPExcel_Reader_IReadFilter
|
||||||
*/
|
*/
|
||||||
protected $_readFilter = NULL;
|
protected $_readFilter = null;
|
||||||
|
|
||||||
protected $_fileHandle = NULL;
|
protected $_fileHandle = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,7 +77,8 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getReadDataOnly() {
|
public function getReadDataOnly()
|
||||||
|
{
|
||||||
return $this->_readDataOnly;
|
return $this->_readDataOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +91,8 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Reader_IReader
|
* @return PHPExcel_Reader_IReader
|
||||||
*/
|
*/
|
||||||
public function setReadDataOnly($pValue = FALSE) {
|
public function setReadDataOnly($pValue = false)
|
||||||
|
{
|
||||||
$this->_readDataOnly = $pValue;
|
$this->_readDataOnly = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +105,8 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getIncludeCharts() {
|
public function getIncludeCharts()
|
||||||
|
{
|
||||||
return $this->_includeCharts;
|
return $this->_includeCharts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +120,8 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Reader_IReader
|
* @return PHPExcel_Reader_IReader
|
||||||
*/
|
*/
|
||||||
public function setIncludeCharts($pValue = FALSE) {
|
public function setIncludeCharts($pValue = false)
|
||||||
|
{
|
||||||
$this->_includeCharts = (boolean) $pValue;
|
$this->_includeCharts = (boolean) $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -143,13 +147,13 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Reader_IReader
|
* @return PHPExcel_Reader_IReader
|
||||||
*/
|
*/
|
||||||
public function setLoadSheetsOnly($value = NULL)
|
public function setLoadSheetsOnly($value = null)
|
||||||
{
|
{
|
||||||
if ($value === NULL)
|
if ($value === null) {
|
||||||
return $this->setLoadAllSheets();
|
return $this->setLoadAllSheets();
|
||||||
|
}
|
||||||
|
|
||||||
$this->_loadSheetsOnly = is_array($value) ?
|
$this->_loadSheetsOnly = is_array($value) ? $value : array($value);
|
||||||
$value : array($value);
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +165,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
*/
|
*/
|
||||||
public function setLoadAllSheets()
|
public function setLoadAllSheets()
|
||||||
{
|
{
|
||||||
$this->_loadSheetsOnly = NULL;
|
$this->_loadSheetsOnly = null;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +174,8 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Reader_IReadFilter
|
* @return PHPExcel_Reader_IReadFilter
|
||||||
*/
|
*/
|
||||||
public function getReadFilter() {
|
public function getReadFilter()
|
||||||
|
{
|
||||||
return $this->_readFilter;
|
return $this->_readFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +185,8 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||||
* @return PHPExcel_Reader_IReader
|
* @return PHPExcel_Reader_IReader
|
||||||
*/
|
*/
|
||||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue)
|
||||||
|
{
|
||||||
$this->_readFilter = $pValue;
|
$this->_readFilter = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +207,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
$this->_fileHandle = fopen($pFilename, 'r');
|
$this->_fileHandle = fopen($pFilename, 'r');
|
||||||
if ($this->_fileHandle === FALSE) {
|
if ($this->_fileHandle === false) {
|
||||||
throw new PHPExcel_Reader_Exception("Could not open file " . $pFilename . " for reading.");
|
throw new PHPExcel_Reader_Exception("Could not open file " . $pFilename . " for reading.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -219,7 +225,7 @@ abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
|
||||||
try {
|
try {
|
||||||
$this->_openFile($pFilename);
|
$this->_openFile($pFilename);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$readable = $this->_isValidFormat();
|
$readable = $this->_isValidFormat();
|
||||||
|
|
|
@ -62,7 +62,8 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Reader_Excel2003XML
|
* Create a new PHPExcel_Reader_Excel2003XML
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct()
|
||||||
|
{
|
||||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,8 +239,8 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static function identifyFixedStyleValue($styleList,&$styleAttributeValue)
|
||||||
protected static function identifyFixedStyleValue($styleList,&$styleAttributeValue) {
|
{
|
||||||
$styleAttributeValue = strtolower($styleAttributeValue);
|
$styleAttributeValue = strtolower($styleAttributeValue);
|
||||||
foreach ($styleList as $style) {
|
foreach ($styleList as $style) {
|
||||||
if ($styleAttributeValue == strtolower($style)) {
|
if ($styleAttributeValue == strtolower($style)) {
|
||||||
|
@ -250,13 +251,13 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pixel units to excel width units(units of 1/256th of a character width)
|
* pixel units to excel width units(units of 1/256th of a character width)
|
||||||
* @param pxs
|
* @param pxs
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected static function _pixel2WidthUnits($pxs) {
|
protected static function _pixel2WidthUnits($pxs)
|
||||||
|
{
|
||||||
$UNIT_OFFSET_MAP = array(0, 36, 73, 109, 146, 182, 219);
|
$UNIT_OFFSET_MAP = array(0, 36, 73, 109, 146, 182, 219);
|
||||||
|
|
||||||
$widthUnits = 256 * ($pxs / 7);
|
$widthUnits = 256 * ($pxs / 7);
|
||||||
|
@ -264,25 +265,24 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||||
return $widthUnits;
|
return $widthUnits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* excel width units(units of 1/256th of a character width) to pixel units
|
* excel width units(units of 1/256th of a character width) to pixel units
|
||||||
* @param widthUnits
|
* @param widthUnits
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected static function _widthUnits2Pixel($widthUnits) {
|
protected static function _widthUnits2Pixel($widthUnits)
|
||||||
|
{
|
||||||
$pixels = ($widthUnits / 256) * 7;
|
$pixels = ($widthUnits / 256) * 7;
|
||||||
$offsetWidthUnits = $widthUnits % 256;
|
$offsetWidthUnits = $widthUnits % 256;
|
||||||
$pixels += round($offsetWidthUnits / (256 / 7));
|
$pixels += round($offsetWidthUnits / (256 / 7));
|
||||||
return $pixels;
|
return $pixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static function _hex2str($hex)
|
||||||
protected static function _hex2str($hex) {
|
{
|
||||||
return chr(hexdec($hex[1]));
|
return chr(hexdec($hex[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file into PHPExcel instance
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
*
|
*
|
||||||
|
@ -321,7 +321,6 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||||
$timezoneObj = new DateTimeZone('Europe/London');
|
$timezoneObj = new DateTimeZone('Europe/London');
|
||||||
$GMT = new DateTimeZone('UTC');
|
$GMT = new DateTimeZone('UTC');
|
||||||
|
|
||||||
|
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
@ -588,14 +587,13 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||||
|
|
||||||
$columnID = 'A';
|
$columnID = 'A';
|
||||||
foreach ($rowData->Cell as $cell) {
|
foreach ($rowData->Cell as $cell) {
|
||||||
|
|
||||||
$cell_ss = $cell->attributes($namespaces['ss']);
|
$cell_ss = $cell->attributes($namespaces['ss']);
|
||||||
if (isset($cell_ss['Index'])) {
|
if (isset($cell_ss['Index'])) {
|
||||||
$columnID = PHPExcel_Cell::stringFromColumnIndex($cell_ss['Index']-1);
|
$columnID = PHPExcel_Cell::stringFromColumnIndex($cell_ss['Index']-1);
|
||||||
}
|
}
|
||||||
$cellRange = $columnID.$rowID;
|
$cellRange = $columnID.$rowID;
|
||||||
|
|
||||||
if ($this->getReadFilter() !== NULL) {
|
if ($this->getReadFilter() !== null) {
|
||||||
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
|
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -700,14 +698,22 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||||
foreach ($cellReferences as $cellReference) {
|
foreach ($cellReferences as $cellReference) {
|
||||||
$rowReference = $cellReference[2][0];
|
$rowReference = $cellReference[2][0];
|
||||||
// Empty R reference is the current row
|
// Empty R reference is the current row
|
||||||
if ($rowReference == '') $rowReference = $rowID;
|
if ($rowReference == '') {
|
||||||
|
$rowReference = $rowID;
|
||||||
|
}
|
||||||
// Bracketed R references are relative to the current row
|
// Bracketed R references are relative to the current row
|
||||||
if ($rowReference{0} == '[') $rowReference = $rowID + trim($rowReference,'[]');
|
if ($rowReference{0} == '[') {
|
||||||
|
$rowReference = $rowID + trim($rowReference,'[]');
|
||||||
|
}
|
||||||
$columnReference = $cellReference[4][0];
|
$columnReference = $cellReference[4][0];
|
||||||
// Empty C reference is the current column
|
// Empty C reference is the current column
|
||||||
if ($columnReference == '') $columnReference = $columnNumber;
|
if ($columnReference == '') {
|
||||||
|
$columnReference = $columnNumber;
|
||||||
|
}
|
||||||
// Bracketed C references are relative to the current column
|
// Bracketed C references are relative to the current column
|
||||||
if ($columnReference{0} == '[') $columnReference = $columnNumber + trim($columnReference,'[]');
|
if ($columnReference{0} == '[') {
|
||||||
|
$columnReference = $columnNumber + trim($columnReference,'[]');
|
||||||
|
}
|
||||||
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
||||||
$value = substr_replace($value, $A1CellReference, $cellReference[0][1],strlen($cellReference[0][0]));
|
$value = substr_replace($value, $A1CellReference, $cellReference[0][1],strlen($cellReference[0][0]));
|
||||||
}
|
}
|
||||||
|
@ -743,9 +749,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||||
// echo $annotation,'<br />';
|
// echo $annotation,'<br />';
|
||||||
$annotation = strip_tags($node);
|
$annotation = strip_tags($node);
|
||||||
// echo 'Annotation: ', $annotation,'<br />';
|
// echo 'Annotation: ', $annotation,'<br />';
|
||||||
$objPHPExcel->getActiveSheet()->getComment( $columnID.$rowID )
|
$objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setAuthor(self::_convertStringEncoding($author , $this->_charSet))->setText($this->_parseRichText($annotation) );
|
||||||
->setAuthor(self::_convertStringEncoding($author , $this->_charSet))
|
|
||||||
->setText($this->_parseRichText($annotation) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($cellIsSet) && (isset($cell_ss['StyleID']))) {
|
if (($cellIsSet) && (isset($cell_ss['StyleID']))) {
|
||||||
|
@ -756,7 +760,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||||
// print_r($this->_styles[$style]);
|
// print_r($this->_styles[$style]);
|
||||||
// echo '<br />';
|
// echo '<br />';
|
||||||
if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) {
|
if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) {
|
||||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(NULL);
|
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(null);
|
||||||
}
|
}
|
||||||
$objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->_styles[$style]);
|
$objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->_styles[$style]);
|
||||||
}
|
}
|
||||||
|
@ -790,7 +794,8 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected static function _convertStringEncoding($string, $charset) {
|
protected static function _convertStringEncoding($string, $charset)
|
||||||
|
{
|
||||||
if ($charset != 'UTF-8') {
|
if ($charset != 'UTF-8') {
|
||||||
return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $charset);
|
return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $charset);
|
||||||
}
|
}
|
||||||
|
@ -798,12 +803,12 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function _parseRichText($is = '') {
|
protected function _parseRichText($is = '')
|
||||||
|
{
|
||||||
$value = new PHPExcel_RichText();
|
$value = new PHPExcel_RichText();
|
||||||
|
|
||||||
$value->createText(self::_convertStringEncoding($is, $this->_charSet));
|
$value->createText(self::_convertStringEncoding($is, $this->_charSet));
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -436,9 +436,7 @@ class PHPExcel_ReferenceHelper
|
||||||
$newCoordinates = PHPExcel_Cell::stringFromColumnIndex($cellIndex-1 + $pNumCols) . ($cell->getRow() + $pNumRows);
|
$newCoordinates = PHPExcel_Cell::stringFromColumnIndex($cellIndex-1 + $pNumCols) . ($cell->getRow() + $pNumRows);
|
||||||
|
|
||||||
// Should the cell be updated? Move value and cellXf index from one cell to another.
|
// Should the cell be updated? Move value and cellXf index from one cell to another.
|
||||||
if (($cellIndex >= $beforeColumnIndex) &&
|
if (($cellIndex >= $beforeColumnIndex) && ($cell->getRow() >= $beforeRow)) {
|
||||||
($cell->getRow() >= $beforeRow)) {
|
|
||||||
|
|
||||||
// Update cell styles
|
// Update cell styles
|
||||||
$pSheet->getCell($newCoordinates)->setXfIndex($cell->getXfIndex());
|
$pSheet->getCell($newCoordinates)->setXfIndex($cell->getXfIndex());
|
||||||
|
|
||||||
|
@ -471,7 +469,6 @@ class PHPExcel_ReferenceHelper
|
||||||
|
|
||||||
if ($pNumCols > 0 && $beforeColumnIndex - 2 > 0) {
|
if ($pNumCols > 0 && $beforeColumnIndex - 2 > 0) {
|
||||||
for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) {
|
for ($i = $beforeRow; $i <= $highestRow - 1; ++$i) {
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex($beforeColumnIndex - 2) . $i;
|
$coordinate = PHPExcel_Cell::stringFromColumnIndex($beforeColumnIndex - 2) . $i;
|
||||||
if ($pSheet->cellExists($coordinate)) {
|
if ($pSheet->cellExists($coordinate)) {
|
||||||
|
@ -495,7 +492,6 @@ class PHPExcel_ReferenceHelper
|
||||||
|
|
||||||
if ($pNumRows > 0 && $beforeRow - 1 > 0) {
|
if ($pNumRows > 0 && $beforeRow - 1 > 0) {
|
||||||
for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
|
for ($i = $beforeColumnIndex - 1; $i <= PHPExcel_Cell::columnIndexFromString($highestColumn) - 1; ++$i) {
|
||||||
|
|
||||||
// Style
|
// Style
|
||||||
$coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . ($beforeRow - 1);
|
$coordinate = PHPExcel_Cell::stringFromColumnIndex($i) . ($beforeRow - 1);
|
||||||
if ($pSheet->cellExists($coordinate)) {
|
if ($pSheet->cellExists($coordinate)) {
|
||||||
|
|
|
@ -196,7 +196,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Worksheet_AutoFilter
|
* @var PHPExcel_Worksheet_AutoFilter
|
||||||
*/
|
*/
|
||||||
private $_autoFilter = NULL;
|
private $_autoFilter = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Freeze pane
|
* Freeze pane
|
||||||
|
@ -334,7 +334,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
// Set parent and title
|
// Set parent and title
|
||||||
$this->_parent = $pParent;
|
$this->_parent = $pParent;
|
||||||
$this->setTitle($pTitle, FALSE);
|
$this->setTitle($pTitle, false);
|
||||||
// setTitle can change $pTitle
|
// setTitle can change $pTitle
|
||||||
$this->setCodeName($this->getTitle());
|
$this->setCodeName($this->getTitle());
|
||||||
$this->setSheetState(PHPExcel_Worksheet::SHEETSTATE_VISIBLE);
|
$this->setSheetState(PHPExcel_Worksheet::SHEETSTATE_VISIBLE);
|
||||||
|
@ -363,12 +363,12 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
$this->_protection = new PHPExcel_Worksheet_Protection();
|
$this->_protection = new PHPExcel_Worksheet_Protection();
|
||||||
|
|
||||||
// Default row dimension
|
// Default row dimension
|
||||||
$this->_defaultRowDimension = new PHPExcel_Worksheet_RowDimension(NULL);
|
$this->_defaultRowDimension = new PHPExcel_Worksheet_RowDimension(null);
|
||||||
|
|
||||||
// Default column dimension
|
// Default column dimension
|
||||||
$this->_defaultColumnDimension = new PHPExcel_Worksheet_ColumnDimension(NULL);
|
$this->_defaultColumnDimension = new PHPExcel_Worksheet_ColumnDimension(null);
|
||||||
|
|
||||||
$this->_autoFilter = new PHPExcel_Worksheet_AutoFilter(NULL, $this);
|
$this->_autoFilter = new PHPExcel_Worksheet_AutoFilter(null, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -377,10 +377,11 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* typically so that the worksheet object can be unset
|
* typically so that the worksheet object can be unset
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function disconnectCells() {
|
public function disconnectCells()
|
||||||
if ( $this->_cellCollection !== NULL) {
|
{
|
||||||
|
if ($this->_cellCollection !== null) {
|
||||||
$this->_cellCollection->unsetWorksheetCells();
|
$this->_cellCollection->unsetWorksheetCells();
|
||||||
$this->_cellCollection = NULL;
|
$this->_cellCollection = null;
|
||||||
}
|
}
|
||||||
// detach ourself from the workbook, so that it can then delete this worksheet successfully
|
// detach ourself from the workbook, so that it can then delete this worksheet successfully
|
||||||
$this->_parent = null;
|
$this->_parent = null;
|
||||||
|
@ -390,9 +391,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* Code to execute when this worksheet is unset()
|
* Code to execute when this worksheet is unset()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function __destruct() {
|
function __destruct()
|
||||||
PHPExcel_Calculation::getInstance($this->_parent)
|
{
|
||||||
->clearCalculationCacheForWorksheet($this->_title);
|
PHPExcel_Calculation::getInstance($this->_parent)->clearCalculationCacheForWorksheet($this->_title);
|
||||||
|
|
||||||
$this->disconnectCells();
|
$this->disconnectCells();
|
||||||
}
|
}
|
||||||
|
@ -402,7 +403,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return PHPExcel_CachedObjectStorage_xxx
|
* @return PHPExcel_CachedObjectStorage_xxx
|
||||||
*/
|
*/
|
||||||
public function getCellCacheController() {
|
public function getCellCacheController()
|
||||||
|
{
|
||||||
return $this->_cellCollection;
|
return $this->_cellCollection;
|
||||||
} // function getCellCacheController()
|
} // function getCellCacheController()
|
||||||
|
|
||||||
|
@ -479,7 +481,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
// Re-order cell collection
|
// Re-order cell collection
|
||||||
return $this->sortCellCollection();
|
return $this->sortCellCollection();
|
||||||
}
|
}
|
||||||
if ($this->_cellCollection !== NULL) {
|
if ($this->_cellCollection !== null) {
|
||||||
return $this->_cellCollection->getCellList();
|
return $this->_cellCollection->getCellList();
|
||||||
}
|
}
|
||||||
return array();
|
return array();
|
||||||
|
@ -492,7 +494,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*/
|
*/
|
||||||
public function sortCellCollection()
|
public function sortCellCollection()
|
||||||
{
|
{
|
||||||
if ($this->_cellCollection !== NULL) {
|
if ($this->_cellCollection !== null) {
|
||||||
return $this->_cellCollection->getSortedCellList();
|
return $this->_cellCollection->getSortedCellList();
|
||||||
}
|
}
|
||||||
return array();
|
return array();
|
||||||
|
@ -725,7 +727,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
|
|
||||||
// There is only something to do if there are some auto-size columns
|
// There is only something to do if there are some auto-size columns
|
||||||
if (!empty($autoSizes)) {
|
if (!empty($autoSizes)) {
|
||||||
|
|
||||||
// build list of cells references that participate in a merge
|
// build list of cells references that participate in a merge
|
||||||
$isMergeCell = array();
|
$isMergeCell = array();
|
||||||
foreach ($this->getMergeCells() as $cells) {
|
foreach ($this->getMergeCells() as $cells) {
|
||||||
|
@ -762,7 +763,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
|
|
||||||
// adjust column widths
|
// adjust column widths
|
||||||
foreach ($autoSizes as $columnIndex => $width) {
|
foreach ($autoSizes as $columnIndex => $width) {
|
||||||
if ($width == -1) $width = $this->getDefaultColumnDimension()->getWidth();
|
if ($width == -1) {
|
||||||
|
$width = $this->getDefaultColumnDimension()->getWidth();
|
||||||
|
}
|
||||||
$this->getColumnDimension($columnIndex)->setWidth($width);
|
$this->getColumnDimension($columnIndex)->setWidth($width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -775,7 +778,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
*/
|
*/
|
||||||
public function getParent() {
|
public function getParent()
|
||||||
|
{
|
||||||
return $this->_parent;
|
return $this->_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,7 +789,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @param PHPExcel $parent
|
* @param PHPExcel $parent
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function rebindParent(PHPExcel $parent) {
|
public function rebindParent(PHPExcel $parent)
|
||||||
|
{
|
||||||
if ($this->_parent !== null) {
|
if ($this->_parent !== null) {
|
||||||
$namedRanges = $this->_parent->getNamedRanges();
|
$namedRanges = $this->_parent->getNamedRanges();
|
||||||
foreach ($namedRanges as $namedRange) {
|
foreach ($namedRanges as $namedRange) {
|
||||||
|
@ -871,9 +876,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
$newTitle = $this->getTitle();
|
$newTitle = $this->getTitle();
|
||||||
PHPExcel_Calculation::getInstance($this->_parent)
|
PHPExcel_Calculation::getInstance($this->_parent)
|
||||||
->renameCalculationCacheForWorksheet($oldTitle, $newTitle);
|
->renameCalculationCacheForWorksheet($oldTitle, $newTitle);
|
||||||
if ($updateFormulaCellReferences)
|
if ($updateFormulaCellReferences) {
|
||||||
PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_parent, $oldTitle, $newTitle);
|
PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_parent, $oldTitle, $newTitle);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -883,7 +889,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return string Sheet state (visible, hidden, veryHidden)
|
* @return string Sheet state (visible, hidden, veryHidden)
|
||||||
*/
|
*/
|
||||||
public function getSheetState() {
|
public function getSheetState()
|
||||||
|
{
|
||||||
return $this->_sheetState;
|
return $this->_sheetState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -893,7 +900,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @param string $value Sheet state (visible, hidden, veryHidden)
|
* @param string $value Sheet state (visible, hidden, veryHidden)
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setSheetState($value = PHPExcel_Worksheet::SHEETSTATE_VISIBLE) {
|
public function setSheetState($value = PHPExcel_Worksheet::SHEETSTATE_VISIBLE)
|
||||||
|
{
|
||||||
$this->_sheetState = $value;
|
$this->_sheetState = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -1159,7 +1167,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
|
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
|
||||||
(preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
|
(preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
|
||||||
$namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
|
$namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
|
||||||
if ($namedRange !== NULL) {
|
if ($namedRange !== null) {
|
||||||
$pCoordinate = $namedRange->getRange();
|
$pCoordinate = $namedRange->getRange();
|
||||||
return $namedRange->getWorksheet()->getCell($pCoordinate);
|
return $namedRange->getWorksheet()->getCell($pCoordinate);
|
||||||
}
|
}
|
||||||
|
@ -1207,29 +1215,26 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
$cell = $this->_cellCollection->addCacheData(
|
$cell = $this->_cellCollection->addCacheData(
|
||||||
$pCoordinate,
|
$pCoordinate,
|
||||||
new PHPExcel_Cell(
|
new PHPExcel_Cell(null, PHPExcel_Cell_DataType::TYPE_NULL, $this)
|
||||||
NULL,
|
|
||||||
PHPExcel_Cell_DataType::TYPE_NULL,
|
|
||||||
$this
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
$this->_cellCollectionIsSorted = false;
|
$this->_cellCollectionIsSorted = false;
|
||||||
|
|
||||||
// Coordinates
|
// Coordinates
|
||||||
$aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate);
|
$aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate);
|
||||||
if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($aCoordinates[0]))
|
if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($aCoordinates[0])) {
|
||||||
$this->_cachedHighestColumn = $aCoordinates[0];
|
$this->_cachedHighestColumn = $aCoordinates[0];
|
||||||
|
}
|
||||||
$this->_cachedHighestRow = max($this->_cachedHighestRow, $aCoordinates[1]);
|
$this->_cachedHighestRow = max($this->_cachedHighestRow, $aCoordinates[1]);
|
||||||
|
|
||||||
// Cell needs appropriate xfIndex from dimensions records
|
// Cell needs appropriate xfIndex from dimensions records
|
||||||
// but don't create dimension records if they don't already exist
|
// but don't create dimension records if they don't already exist
|
||||||
$rowDimension = $this->getRowDimension($aCoordinates[1], FALSE);
|
$rowDimension = $this->getRowDimension($aCoordinates[1], false);
|
||||||
$columnDimension = $this->getColumnDimension($aCoordinates[0], FALSE);
|
$columnDimension = $this->getColumnDimension($aCoordinates[0], false);
|
||||||
|
|
||||||
if ($rowDimension !== NULL && $rowDimension->getXfIndex() > 0) {
|
if ($rowDimension !== null && $rowDimension->getXfIndex() > 0) {
|
||||||
// then there is a row dimension with explicit style, assign it to the cell
|
// then there is a row dimension with explicit style, assign it to the cell
|
||||||
$cell->setXfIndex($rowDimension->getXfIndex());
|
$cell->setXfIndex($rowDimension->getXfIndex());
|
||||||
} elseif ($columnDimension !== NULL && $columnDimension->getXfIndex() > 0) {
|
} elseif ($columnDimension !== null && $columnDimension->getXfIndex() > 0) {
|
||||||
// then there is a column dimension, assign it to the cell
|
// then there is a column dimension, assign it to the cell
|
||||||
$cell->setXfIndex($columnDimension->getXfIndex());
|
$cell->setXfIndex($columnDimension->getXfIndex());
|
||||||
}
|
}
|
||||||
|
@ -1256,7 +1261,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
|
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
|
||||||
(preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
|
(preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
|
||||||
$namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
|
$namedRange = PHPExcel_NamedRange::resolveRange($pCoordinate, $this);
|
||||||
if ($namedRange !== NULL) {
|
if ($namedRange !== null) {
|
||||||
$pCoordinate = $namedRange->getRange();
|
$pCoordinate = $namedRange->getRange();
|
||||||
if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) {
|
if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) {
|
||||||
if (!$namedRange->getLocalOnly()) {
|
if (!$namedRange->getLocalOnly()) {
|
||||||
|
@ -1265,8 +1270,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
throw new PHPExcel_Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle());
|
throw new PHPExcel_Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else { return false; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uppercase coordinate
|
// Uppercase coordinate
|
||||||
|
@ -1303,15 +1309,16 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @param int $pRow Numeric index of the row
|
* @param int $pRow Numeric index of the row
|
||||||
* @return PHPExcel_Worksheet_RowDimension
|
* @return PHPExcel_Worksheet_RowDimension
|
||||||
*/
|
*/
|
||||||
public function getRowDimension($pRow = 1, $create = TRUE)
|
public function getRowDimension($pRow = 1, $create = true)
|
||||||
{
|
{
|
||||||
// Found
|
// Found
|
||||||
$found = null;
|
$found = null;
|
||||||
|
|
||||||
// Get row dimension
|
// Get row dimension
|
||||||
if (!isset($this->_rowDimensions[$pRow])) {
|
if (!isset($this->_rowDimensions[$pRow])) {
|
||||||
if (!$create)
|
if (!$create) {
|
||||||
return NULL;
|
return null;
|
||||||
|
}
|
||||||
$this->_rowDimensions[$pRow] = new PHPExcel_Worksheet_RowDimension($pRow);
|
$this->_rowDimensions[$pRow] = new PHPExcel_Worksheet_RowDimension($pRow);
|
||||||
|
|
||||||
$this->_cachedHighestRow = max($this->_cachedHighestRow, $pRow);
|
$this->_cachedHighestRow = max($this->_cachedHighestRow, $pRow);
|
||||||
|
@ -1325,20 +1332,22 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @param string $pColumn String index of the column
|
* @param string $pColumn String index of the column
|
||||||
* @return PHPExcel_Worksheet_ColumnDimension
|
* @return PHPExcel_Worksheet_ColumnDimension
|
||||||
*/
|
*/
|
||||||
public function getColumnDimension($pColumn = 'A', $create = TRUE)
|
public function getColumnDimension($pColumn = 'A', $create = true)
|
||||||
{
|
{
|
||||||
// Uppercase coordinate
|
// Uppercase coordinate
|
||||||
$pColumn = strtoupper($pColumn);
|
$pColumn = strtoupper($pColumn);
|
||||||
|
|
||||||
// Fetch dimensions
|
// Fetch dimensions
|
||||||
if (!isset($this->_columnDimensions[$pColumn])) {
|
if (!isset($this->_columnDimensions[$pColumn])) {
|
||||||
if (!$create)
|
if (!$create) {
|
||||||
return NULL;
|
return null;
|
||||||
|
}
|
||||||
$this->_columnDimensions[$pColumn] = new PHPExcel_Worksheet_ColumnDimension($pColumn);
|
$this->_columnDimensions[$pColumn] = new PHPExcel_Worksheet_ColumnDimension($pColumn);
|
||||||
|
|
||||||
if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($pColumn))
|
if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($pColumn)) {
|
||||||
$this->_cachedHighestColumn = $pColumn;
|
$this->_cachedHighestColumn = $pColumn;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $this->_columnDimensions[$pColumn];
|
return $this->_columnDimensions[$pColumn];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1488,8 +1497,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1, $pColumn2 = null, $pRow2 = null)
|
public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1, $pColumn2 = null, $pRow2 = null)
|
||||||
{
|
{
|
||||||
if (!is_null($pColumn2) && !is_null($pRow2)) {
|
if (!is_null($pColumn2) && !is_null($pRow2)) {
|
||||||
$cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow . ':' .
|
$cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
|
||||||
PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
|
|
||||||
return $this->getStyle($cellRange);
|
return $this->getStyle($cellRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1699,7 +1707,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
for ($i = 1; $i < $count; $i++) {
|
for ($i = 1; $i < $count; $i++) {
|
||||||
$this->getCell($aReferences[$i])->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL);
|
$this->getCell($aReferences[$i])->setValueExplicit(null, PHPExcel_Cell_DataType::TYPE_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Exception('Merge must be set on a range of cells.');
|
throw new PHPExcel_Exception('Merge must be set on a range of cells.');
|
||||||
}
|
}
|
||||||
|
@ -1783,7 +1790,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
public function setMergeCells($pValue = array())
|
public function setMergeCells($pValue = array())
|
||||||
{
|
{
|
||||||
$this->_mergeCells = $pValue;
|
$this->_mergeCells = $pValue;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1896,7 +1902,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
public function setAutoFilter($pValue)
|
public function setAutoFilter($pValue)
|
||||||
{
|
{
|
||||||
$pRange = strtoupper($pValue);
|
$pRange = strtoupper($pValue);
|
||||||
|
|
||||||
if (is_string($pValue)) {
|
if (is_string($pValue)) {
|
||||||
$this->_autoFilter->setRange($pValue);
|
$this->_autoFilter->setRange($pValue);
|
||||||
} elseif (is_object($pValue) && ($pValue instanceof PHPExcel_Worksheet_AutoFilter)) {
|
} elseif (is_object($pValue) && ($pValue instanceof PHPExcel_Worksheet_AutoFilter)) {
|
||||||
|
@ -1931,7 +1936,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*/
|
*/
|
||||||
public function removeAutoFilter()
|
public function removeAutoFilter()
|
||||||
{
|
{
|
||||||
$this->_autoFilter->setRange(NULL);
|
$this->_autoFilter->setRange(null);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1961,7 +1966,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
// Uppercase coordinate
|
// Uppercase coordinate
|
||||||
$pCell = strtoupper($pCell);
|
$pCell = strtoupper($pCell);
|
||||||
|
|
||||||
if (strpos($pCell, ':') === false && strpos($pCell, ',') === false) {
|
if (strpos($pCell, ':') === false && strpos($pCell, ',') === false) {
|
||||||
$this->_freezePane = $pCell;
|
$this->_freezePane = $pCell;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2001,7 +2005,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function insertNewRowBefore($pBefore = 1, $pNumRows = 1) {
|
public function insertNewRowBefore($pBefore = 1, $pNumRows = 1)
|
||||||
|
{
|
||||||
if ($pBefore >= 1) {
|
if ($pBefore >= 1) {
|
||||||
$objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
|
$objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
|
||||||
$objReferenceHelper->insertNewBefore('A' . $pBefore, 0, $pNumRows, $this);
|
$objReferenceHelper->insertNewBefore('A' . $pBefore, 0, $pNumRows, $this);
|
||||||
|
@ -2019,7 +2024,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function insertNewColumnBefore($pBefore = 'A', $pNumCols = 1) {
|
public function insertNewColumnBefore($pBefore = 'A', $pNumCols = 1)
|
||||||
|
{
|
||||||
if (!is_numeric($pBefore)) {
|
if (!is_numeric($pBefore)) {
|
||||||
$objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
|
$objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
|
||||||
$objReferenceHelper->insertNewBefore($pBefore . '1', $pNumCols, 0, $this);
|
$objReferenceHelper->insertNewBefore($pBefore . '1', $pNumCols, 0, $this);
|
||||||
|
@ -2037,7 +2043,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function insertNewColumnBeforeByIndex($pBefore = 0, $pNumCols = 1) {
|
public function insertNewColumnBeforeByIndex($pBefore = 0, $pNumCols = 1)
|
||||||
|
{
|
||||||
if ($pBefore >= 0) {
|
if ($pBefore >= 0) {
|
||||||
return $this->insertNewColumnBefore(PHPExcel_Cell::stringFromColumnIndex($pBefore), $pNumCols);
|
return $this->insertNewColumnBefore(PHPExcel_Cell::stringFromColumnIndex($pBefore), $pNumCols);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2053,7 +2060,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function removeRow($pRow = 1, $pNumRows = 1) {
|
public function removeRow($pRow = 1, $pNumRows = 1)
|
||||||
|
{
|
||||||
if ($pRow >= 1) {
|
if ($pRow >= 1) {
|
||||||
$highestRow = $this->getHighestDataRow();
|
$highestRow = $this->getHighestDataRow();
|
||||||
$objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
|
$objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
|
||||||
|
@ -2076,7 +2084,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function removeColumn($pColumn = 'A', $pNumCols = 1) {
|
public function removeColumn($pColumn = 'A', $pNumCols = 1)
|
||||||
|
{
|
||||||
if (!is_numeric($pColumn)) {
|
if (!is_numeric($pColumn)) {
|
||||||
$highestColumn = $this->getHighestDataColumn();
|
$highestColumn = $this->getHighestDataColumn();
|
||||||
$pColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($pColumn) - 1 + $pNumCols);
|
$pColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($pColumn) - 1 + $pNumCols);
|
||||||
|
@ -2100,7 +2109,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function removeColumnByIndex($pColumn = 0, $pNumCols = 1) {
|
public function removeColumnByIndex($pColumn = 0, $pNumCols = 1)
|
||||||
|
{
|
||||||
if ($pColumn >= 0) {
|
if ($pColumn >= 0) {
|
||||||
return $this->removeColumn(PHPExcel_Cell::stringFromColumnIndex($pColumn), $pNumCols);
|
return $this->removeColumn(PHPExcel_Cell::stringFromColumnIndex($pColumn), $pNumCols);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2113,7 +2123,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getShowGridlines() {
|
public function getShowGridlines()
|
||||||
|
{
|
||||||
return $this->_showGridlines;
|
return $this->_showGridlines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2123,7 +2134,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @param boolean $pValue Show gridlines (true/false)
|
* @param boolean $pValue Show gridlines (true/false)
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setShowGridlines($pValue = false) {
|
public function setShowGridlines($pValue = false)
|
||||||
|
{
|
||||||
$this->_showGridlines = $pValue;
|
$this->_showGridlines = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -2133,7 +2145,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getPrintGridlines() {
|
public function getPrintGridlines()
|
||||||
|
{
|
||||||
return $this->_printGridlines;
|
return $this->_printGridlines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2143,7 +2156,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @param boolean $pValue Print gridlines (true/false)
|
* @param boolean $pValue Print gridlines (true/false)
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setPrintGridlines($pValue = false) {
|
public function setPrintGridlines($pValue = false)
|
||||||
|
{
|
||||||
$this->_printGridlines = $pValue;
|
$this->_printGridlines = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -2153,7 +2167,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getShowRowColHeaders() {
|
public function getShowRowColHeaders()
|
||||||
|
{
|
||||||
return $this->_showRowColHeaders;
|
return $this->_showRowColHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2163,7 +2178,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @param boolean $pValue Show row and column headers (true/false)
|
* @param boolean $pValue Show row and column headers (true/false)
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setShowRowColHeaders($pValue = false) {
|
public function setShowRowColHeaders($pValue = false)
|
||||||
|
{
|
||||||
$this->_showRowColHeaders = $pValue;
|
$this->_showRowColHeaders = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -2173,7 +2189,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getShowSummaryBelow() {
|
public function getShowSummaryBelow()
|
||||||
|
{
|
||||||
return $this->_showSummaryBelow;
|
return $this->_showSummaryBelow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2183,7 +2200,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @param boolean $pValue Show summary below (true/false)
|
* @param boolean $pValue Show summary below (true/false)
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setShowSummaryBelow($pValue = true) {
|
public function setShowSummaryBelow($pValue = true)
|
||||||
|
{
|
||||||
$this->_showSummaryBelow = $pValue;
|
$this->_showSummaryBelow = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -2193,7 +2211,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getShowSummaryRight() {
|
public function getShowSummaryRight()
|
||||||
|
{
|
||||||
return $this->_showSummaryRight;
|
return $this->_showSummaryRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2203,7 +2222,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @param boolean $pValue Show summary right (true/false)
|
* @param boolean $pValue Show summary right (true/false)
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setShowSummaryRight($pValue = true) {
|
public function setShowSummaryRight($pValue = true)
|
||||||
|
{
|
||||||
$this->_showSummaryRight = $pValue;
|
$this->_showSummaryRight = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -2368,7 +2388,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getRightToLeft() {
|
public function getRightToLeft()
|
||||||
|
{
|
||||||
return $this->_rightToLeft;
|
return $this->_rightToLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2378,7 +2399,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @param boolean $value Right-to-left true/false
|
* @param boolean $value Right-to-left true/false
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setRightToLeft($value = false) {
|
public function setRightToLeft($value = false)
|
||||||
|
{
|
||||||
$this->_rightToLeft = $value;
|
$this->_rightToLeft = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -2393,7 +2415,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function fromArray($source = null, $nullValue = null, $startCell = 'A1', $strictNullComparison = false) {
|
public function fromArray($source = null, $nullValue = null, $startCell = 'A1', $strictNullComparison = false)
|
||||||
|
{
|
||||||
if (is_array($source)) {
|
if (is_array($source)) {
|
||||||
// Convert a 1-D array to 2-D (for ease of looping)
|
// Convert a 1-D array to 2-D (for ease of looping)
|
||||||
if (!is_array(end($source))) {
|
if (!is_array(end($source))) {
|
||||||
|
@ -2439,7 +2462,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* True - Return rows and columns indexed by their actual row and column IDs
|
* True - Return rows and columns indexed by their actual row and column IDs
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) {
|
public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false)
|
||||||
|
{
|
||||||
// Returnvalue
|
// Returnvalue
|
||||||
$returnValue = array();
|
$returnValue = array();
|
||||||
// Identify the range that we need to extract from the worksheet
|
// Identify the range that we need to extract from the worksheet
|
||||||
|
@ -2511,14 +2535,14 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @return array
|
* @return array
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) {
|
public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false)
|
||||||
|
{
|
||||||
$namedRange = PHPExcel_NamedRange::resolveRange($pNamedRange, $this);
|
$namedRange = PHPExcel_NamedRange::resolveRange($pNamedRange, $this);
|
||||||
if ($namedRange !== NULL) {
|
if ($namedRange !== null) {
|
||||||
$pWorkSheet = $namedRange->getWorksheet();
|
$pWorkSheet = $namedRange->getWorksheet();
|
||||||
$pCellRange = $namedRange->getRange();
|
$pCellRange = $namedRange->getRange();
|
||||||
|
|
||||||
return $pWorkSheet->rangeToArray( $pCellRange,
|
return $pWorkSheet->rangeToArray($pCellRange, $nullValue, $calculateFormulas, $formatData, $returnCellRef);
|
||||||
$nullValue, $calculateFormulas, $formatData, $returnCellRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new PHPExcel_Exception('Named Range '.$pNamedRange.' does not exist.');
|
throw new PHPExcel_Exception('Named Range '.$pNamedRange.' does not exist.');
|
||||||
|
@ -2535,7 +2559,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* True - Return rows and columns indexed by their actual row and column IDs
|
* True - Return rows and columns indexed by their actual row and column IDs
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) {
|
public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false)
|
||||||
|
{
|
||||||
// Garbage collect...
|
// Garbage collect...
|
||||||
$this->garbageCollect();
|
$this->garbageCollect();
|
||||||
|
|
||||||
|
@ -2543,8 +2568,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
$maxCol = $this->getHighestColumn();
|
$maxCol = $this->getHighestColumn();
|
||||||
$maxRow = $this->getHighestRow();
|
$maxRow = $this->getHighestRow();
|
||||||
// Return
|
// Return
|
||||||
return $this->rangeToArray( 'A1:'.$maxCol.$maxRow,
|
return $this->rangeToArray('A1:'.$maxCol.$maxRow, $nullValue, $calculateFormulas, $formatData, $returnCellRef);
|
||||||
$nullValue, $calculateFormulas, $formatData, $returnCellRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2555,7 +2579,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Worksheet_RowIterator
|
* @return PHPExcel_Worksheet_RowIterator
|
||||||
*/
|
*/
|
||||||
public function getRowIterator($startRow = 1, $endRow = null) {
|
public function getRowIterator($startRow = 1, $endRow = null)
|
||||||
|
{
|
||||||
return new PHPExcel_Worksheet_RowIterator($this, $startRow, $endRow);
|
return new PHPExcel_Worksheet_RowIterator($this, $startRow, $endRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2567,7 +2592,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Worksheet_ColumnIterator
|
* @return PHPExcel_Worksheet_ColumnIterator
|
||||||
*/
|
*/
|
||||||
public function getColumnIterator($startColumn = 'A', $endColumn = null) {
|
public function getColumnIterator($startColumn = 'A', $endColumn = null)
|
||||||
|
{
|
||||||
return new PHPExcel_Worksheet_ColumnIterator($this, $startColumn, $endColumn);
|
return new PHPExcel_Worksheet_ColumnIterator($this, $startColumn, $endColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2576,7 +2602,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function garbageCollect() {
|
public function garbageCollect()
|
||||||
|
{
|
||||||
// Flush cache
|
// Flush cache
|
||||||
$this->_cellCollection->getCacheData('A1');
|
$this->_cellCollection->getCacheData('A1');
|
||||||
// Build a reference table from images
|
// Build a reference table from images
|
||||||
|
@ -2620,13 +2647,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return string Hash code
|
* @return string Hash code
|
||||||
*/
|
*/
|
||||||
public function getHashCode() {
|
public function getHashCode()
|
||||||
|
{
|
||||||
if ($this->_dirty) {
|
if ($this->_dirty) {
|
||||||
$this->_hash = md5( $this->_title .
|
$this->_hash = md5($this->_title . $this->_autoFilter . ($this->_protection->isProtectionEnabled() ? 't' : 'f') . __CLASS__);
|
||||||
$this->_autoFilter .
|
|
||||||
($this->_protection->isProtectionEnabled() ? 't' : 'f') .
|
|
||||||
__CLASS__
|
|
||||||
);
|
|
||||||
$this->_dirty = false;
|
$this->_dirty = false;
|
||||||
}
|
}
|
||||||
return $this->_hash;
|
return $this->_hash;
|
||||||
|
@ -2642,17 +2666,15 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @param bool $returnRange Return range? (see example)
|
* @param bool $returnRange Return range? (see example)
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function extractSheetTitle($pRange, $returnRange = false) {
|
public static function extractSheetTitle($pRange, $returnRange = false)
|
||||||
|
{
|
||||||
// Sheet title included?
|
// Sheet title included?
|
||||||
if (($sep = strpos($pRange, '!')) === false) {
|
if (($sep = strpos($pRange, '!')) === false) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($returnRange) {
|
if ($returnRange) {
|
||||||
return array(
|
return array(trim(substr($pRange, 0, $sep),"'"), substr($pRange, $sep + 1));
|
||||||
trim(substr($pRange, 0, $sep),"'"),
|
|
||||||
substr($pRange, $sep + 1)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return substr($pRange, $sep + 1);
|
return substr($pRange, $sep + 1);
|
||||||
|
@ -2774,7 +2796,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @param string $range
|
* @param string $range
|
||||||
* @return string Adjusted range value
|
* @return string Adjusted range value
|
||||||
*/
|
*/
|
||||||
public function shrinkRangeToFit($range) {
|
public function shrinkRangeToFit($range)
|
||||||
|
{
|
||||||
$maxCol = $this->getHighestColumn();
|
$maxCol = $this->getHighestColumn();
|
||||||
$maxRow = $this->getHighestRow();
|
$maxRow = $this->getHighestRow();
|
||||||
$maxCol = PHPExcel_Cell::columnIndexFromString($maxCol);
|
$maxCol = PHPExcel_Cell::columnIndexFromString($maxCol);
|
||||||
|
@ -2783,10 +2806,18 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
foreach ($rangeBlocks as &$rangeSet) {
|
foreach ($rangeBlocks as &$rangeSet) {
|
||||||
$rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($rangeSet);
|
$rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($rangeSet);
|
||||||
|
|
||||||
if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[0][0]) > $maxCol) { $rangeBoundaries[0][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol); }
|
if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[0][0]) > $maxCol) {
|
||||||
if ($rangeBoundaries[0][1] > $maxRow) { $rangeBoundaries[0][1] = $maxRow; }
|
$rangeBoundaries[0][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol);
|
||||||
if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[1][0]) > $maxCol) { $rangeBoundaries[1][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol); }
|
}
|
||||||
if ($rangeBoundaries[1][1] > $maxRow) { $rangeBoundaries[1][1] = $maxRow; }
|
if ($rangeBoundaries[0][1] > $maxRow) {
|
||||||
|
$rangeBoundaries[0][1] = $maxRow;
|
||||||
|
}
|
||||||
|
if (PHPExcel_Cell::columnIndexFromString($rangeBoundaries[1][0]) > $maxCol) {
|
||||||
|
$rangeBoundaries[1][0] = PHPExcel_Cell::stringFromColumnIndex($maxCol);
|
||||||
|
}
|
||||||
|
if ($rangeBoundaries[1][1] > $maxRow) {
|
||||||
|
$rangeBoundaries[1][1] = $maxRow;
|
||||||
|
}
|
||||||
$rangeSet = $rangeBoundaries[0][0].$rangeBoundaries[0][1].':'.$rangeBoundaries[1][0].$rangeBoundaries[1][1];
|
$rangeSet = $rangeBoundaries[0][0].$rangeBoundaries[0][1].':'.$rangeBoundaries[1][0].$rangeBoundaries[1][1];
|
||||||
}
|
}
|
||||||
unset($rangeSet);
|
unset($rangeSet);
|
||||||
|
@ -2802,7 +2833,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*/
|
*/
|
||||||
public function getTabColor()
|
public function getTabColor()
|
||||||
{
|
{
|
||||||
if ($this->_tabColor === NULL)
|
if ($this->_tabColor === null)
|
||||||
$this->_tabColor = new PHPExcel_Style_Color();
|
$this->_tabColor = new PHPExcel_Style_Color();
|
||||||
|
|
||||||
return $this->_tabColor;
|
return $this->_tabColor;
|
||||||
|
@ -2828,7 +2859,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*/
|
*/
|
||||||
public function isTabColorSet()
|
public function isTabColorSet()
|
||||||
{
|
{
|
||||||
return ($this->_tabColor !== NULL);
|
return ($this->_tabColor !== null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2845,7 +2876,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
/**
|
/**
|
||||||
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
* Implement PHP __clone to create a deep clone, not just a shallow copy.
|
||||||
*/
|
*/
|
||||||
public function __clone() {
|
public function __clone()
|
||||||
|
{
|
||||||
foreach ($this as $key => $val) {
|
foreach ($this as $key => $val) {
|
||||||
if ($key == '_parent') {
|
if ($key == '_parent') {
|
||||||
continue;
|
continue;
|
||||||
|
@ -2876,7 +2908,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
* @return objWorksheet
|
* @return objWorksheet
|
||||||
* @throws PHPExcel_Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function setCodeName($pValue=null) {
|
public function setCodeName($pValue=null)
|
||||||
|
{
|
||||||
// Is this a 'rename' or not?
|
// Is this a 'rename' or not?
|
||||||
if ($this->getCodeName() == $pValue) {
|
if ($this->getCodeName() == $pValue) {
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -2924,14 +2957,16 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
*
|
*
|
||||||
* @return null|string
|
* @return null|string
|
||||||
*/
|
*/
|
||||||
public function getCodeName() {
|
public function getCodeName()
|
||||||
|
{
|
||||||
return $this->_codeName;
|
return $this->_codeName;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Sheet has a code name ?
|
* Sheet has a code name ?
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function hasCodeName() {
|
public function hasCodeName()
|
||||||
|
{
|
||||||
return !(is_null($this->_codeName));
|
return !(is_null($this->_codeName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue