mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-26 07:16:03 +03:00
Performance and memory improvements to Excel5 OLE Reader
Temporary fix to XML flush until I get it working correctly Use of PHPExcel_Exception
This commit is contained in:
parent
d8debd0966
commit
b98f27f4a7
@ -196,7 +196,7 @@ class PHPExcel
|
|||||||
*
|
*
|
||||||
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
|
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function createSheet($iSheetIndex = NULL)
|
public function createSheet($iSheetIndex = NULL)
|
||||||
{
|
{
|
||||||
@ -222,12 +222,12 @@ class PHPExcel
|
|||||||
* @param PHPExcel_Worksheet $pSheet
|
* @param PHPExcel_Worksheet $pSheet
|
||||||
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
|
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = NULL)
|
public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = NULL)
|
||||||
{
|
{
|
||||||
if ($this->sheetNameExists($pSheet->getTitle())) {
|
if ($this->sheetNameExists($pSheet->getTitle())) {
|
||||||
throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first.");
|
throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if($iSheetIndex === NULL) {
|
if($iSheetIndex === NULL) {
|
||||||
@ -256,12 +256,12 @@ class PHPExcel
|
|||||||
* Remove sheet by index
|
* Remove sheet by index
|
||||||
*
|
*
|
||||||
* @param int $pIndex Active sheet index
|
* @param int $pIndex Active sheet index
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function removeSheetByIndex($pIndex = 0)
|
public function removeSheetByIndex($pIndex = 0)
|
||||||
{
|
{
|
||||||
if ($pIndex > count($this->_workSheetCollection) - 1) {
|
if ($pIndex > count($this->_workSheetCollection) - 1) {
|
||||||
throw new Exception("Sheet index is out of bounds.");
|
throw new PHPExcel_Exception("Sheet index is out of bounds.");
|
||||||
} else {
|
} else {
|
||||||
array_splice($this->_workSheetCollection, $pIndex, 1);
|
array_splice($this->_workSheetCollection, $pIndex, 1);
|
||||||
}
|
}
|
||||||
@ -278,12 +278,12 @@ class PHPExcel
|
|||||||
*
|
*
|
||||||
* @param int $pIndex Sheet index
|
* @param int $pIndex Sheet index
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function getSheet($pIndex = 0)
|
public function getSheet($pIndex = 0)
|
||||||
{
|
{
|
||||||
if ($pIndex > count($this->_workSheetCollection) - 1) {
|
if ($pIndex > count($this->_workSheetCollection) - 1) {
|
||||||
throw new Exception("Sheet index is out of bounds.");
|
throw new PHPExcel_Exception("Sheet index is out of bounds.");
|
||||||
} else {
|
} else {
|
||||||
return $this->_workSheetCollection[$pIndex];
|
return $this->_workSheetCollection[$pIndex];
|
||||||
}
|
}
|
||||||
@ -304,7 +304,6 @@ class PHPExcel
|
|||||||
*
|
*
|
||||||
* @param string $pName Sheet name
|
* @param string $pName Sheet name
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function getSheetByName($pName = '')
|
public function getSheetByName($pName = '')
|
||||||
{
|
{
|
||||||
@ -315,7 +314,7 @@ class PHPExcel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -323,7 +322,7 @@ class PHPExcel
|
|||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $pSheet
|
* @param PHPExcel_Worksheet $pSheet
|
||||||
* @return Sheet index
|
* @return Sheet index
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function getIndex(PHPExcel_Worksheet $pSheet)
|
public function getIndex(PHPExcel_Worksheet $pSheet)
|
||||||
{
|
{
|
||||||
@ -332,6 +331,8 @@ class PHPExcel
|
|||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new PHPExcel_Exception("Sheet does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -340,7 +341,7 @@ class PHPExcel
|
|||||||
* @param string $sheetName Sheet name to modify index for
|
* @param string $sheetName Sheet name to modify index for
|
||||||
* @param int $newIndex New index for the sheet
|
* @param int $newIndex New index for the sheet
|
||||||
* @return New sheet index
|
* @return New sheet index
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function setIndexByName($sheetName, $newIndex)
|
public function setIndexByName($sheetName, $newIndex)
|
||||||
{
|
{
|
||||||
@ -383,13 +384,13 @@ class PHPExcel
|
|||||||
* Set active sheet index
|
* Set active sheet index
|
||||||
*
|
*
|
||||||
* @param int $pIndex Active sheet index
|
* @param int $pIndex Active sheet index
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setActiveSheetIndex($pIndex = 0)
|
public function setActiveSheetIndex($pIndex = 0)
|
||||||
{
|
{
|
||||||
if ($pIndex > count($this->_workSheetCollection) - 1) {
|
if ($pIndex > count($this->_workSheetCollection) - 1) {
|
||||||
throw new Exception("Active sheet index is out of bounds.");
|
throw new PHPExcel_Exception("Active sheet index is out of bounds.");
|
||||||
} else {
|
} else {
|
||||||
$this->_activeSheetIndex = $pIndex;
|
$this->_activeSheetIndex = $pIndex;
|
||||||
}
|
}
|
||||||
@ -401,7 +402,7 @@ class PHPExcel
|
|||||||
*
|
*
|
||||||
* @param string $pValue Sheet title
|
* @param string $pValue Sheet title
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function setActiveSheetIndexByName($pValue = '')
|
public function setActiveSheetIndexByName($pValue = '')
|
||||||
{
|
{
|
||||||
@ -410,7 +411,7 @@ class PHPExcel
|
|||||||
return $worksheet;
|
return $worksheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception('Workbook does not contain sheet:' . $pValue);
|
throw new PHPExcel_Exception('Workbook does not contain sheet:' . $pValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -434,12 +435,12 @@ class PHPExcel
|
|||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $pSheet External sheet to add
|
* @param PHPExcel_Worksheet $pSheet External sheet to add
|
||||||
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
|
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) {
|
public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) {
|
||||||
if ($this->sheetNameExists($pSheet->getTitle())) {
|
if ($this->sheetNameExists($pSheet->getTitle())) {
|
||||||
throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
|
throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// count how many cellXfs there are in this workbook currently, we will need this below
|
// count how many cellXfs there are in this workbook currently, we will need this below
|
||||||
@ -622,14 +623,14 @@ class PHPExcel
|
|||||||
* Get default style
|
* Get default style
|
||||||
*
|
*
|
||||||
* @return PHPExcel_Style
|
* @return PHPExcel_Style
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function getDefaultStyle()
|
public function getDefaultStyle()
|
||||||
{
|
{
|
||||||
if (isset($this->_cellXfCollection[0])) {
|
if (isset($this->_cellXfCollection[0])) {
|
||||||
return $this->_cellXfCollection[0];
|
return $this->_cellXfCollection[0];
|
||||||
}
|
}
|
||||||
throw new Exception('No default style found for this workbook');
|
throw new PHPExcel_Exception('No default style found for this workbook');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -647,12 +648,12 @@ class PHPExcel
|
|||||||
* Remove cellXf by index. It is ensured that all cells get their xf index updated.
|
* Remove cellXf by index. It is ensured that all cells get their xf index updated.
|
||||||
*
|
*
|
||||||
* @param int $pIndex Index to cellXf
|
* @param int $pIndex Index to cellXf
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function removeCellXfByIndex($pIndex = 0)
|
public function removeCellXfByIndex($pIndex = 0)
|
||||||
{
|
{
|
||||||
if ($pIndex > count($this->_cellXfCollection) - 1) {
|
if ($pIndex > count($this->_cellXfCollection) - 1) {
|
||||||
throw new Exception("CellXf index is out of bounds.");
|
throw new PHPExcel_Exception("CellXf index is out of bounds.");
|
||||||
} else {
|
} else {
|
||||||
// first remove the cellXf
|
// first remove the cellXf
|
||||||
array_splice($this->_cellXfCollection, $pIndex, 1);
|
array_splice($this->_cellXfCollection, $pIndex, 1);
|
||||||
@ -736,12 +737,12 @@ class PHPExcel
|
|||||||
* Remove cellStyleXf by index
|
* Remove cellStyleXf by index
|
||||||
*
|
*
|
||||||
* @param int $pIndex
|
* @param int $pIndex
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function removeCellStyleXfByIndex($pIndex = 0)
|
public function removeCellStyleXfByIndex($pIndex = 0)
|
||||||
{
|
{
|
||||||
if ($pIndex > count($this->_cellStyleXfCollection) - 1) {
|
if ($pIndex > count($this->_cellStyleXfCollection) - 1) {
|
||||||
throw new Exception("CellStyleXf index is out of bounds.");
|
throw new PHPExcel_Exception("CellStyleXf index is out of bounds.");
|
||||||
} else {
|
} else {
|
||||||
array_splice($this->_cellStyleXfCollection, $pIndex, 1);
|
array_splice($this->_cellStyleXfCollection, $pIndex, 1);
|
||||||
}
|
}
|
||||||
|
@ -727,7 +727,6 @@ class PHPExcel_Cell
|
|||||||
*
|
*
|
||||||
* @param string $pString
|
* @param string $pString
|
||||||
* @return int Column index (base 1 !!!)
|
* @return int Column index (base 1 !!!)
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static function columnIndexFromString($pString = 'A')
|
public static function columnIndexFromString($pString = 'A')
|
||||||
{
|
{
|
||||||
@ -894,11 +893,11 @@ class PHPExcel_Cell
|
|||||||
* Set value binder to use
|
* Set value binder to use
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Cell_IValueBinder $binder
|
* @param PHPExcel_Cell_IValueBinder $binder
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = NULL) {
|
public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = NULL) {
|
||||||
if ($binder === NULL) {
|
if ($binder === NULL) {
|
||||||
throw new Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
|
throw new PHPExcel_Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$_valueBinder = $binder;
|
self::$_valueBinder = $binder;
|
||||||
|
@ -53,7 +53,7 @@ class PHPExcel_HashTable
|
|||||||
* Create a new PHPExcel_HashTable
|
* Create a new PHPExcel_HashTable
|
||||||
*
|
*
|
||||||
* @param PHPExcel_IComparable[] $pSource Optional source array to create HashTable from
|
* @param PHPExcel_IComparable[] $pSource Optional source array to create HashTable from
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function __construct($pSource = null)
|
public function __construct($pSource = null)
|
||||||
{
|
{
|
||||||
@ -67,14 +67,14 @@ class PHPExcel_HashTable
|
|||||||
* Add HashTable items from source
|
* Add HashTable items from source
|
||||||
*
|
*
|
||||||
* @param PHPExcel_IComparable[] $pSource Source array to create HashTable from
|
* @param PHPExcel_IComparable[] $pSource Source array to create HashTable from
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function addFromSource($pSource = null) {
|
public function addFromSource($pSource = null) {
|
||||||
// Check if an array was passed
|
// Check if an array was passed
|
||||||
if ($pSource == null) {
|
if ($pSource == null) {
|
||||||
return;
|
return;
|
||||||
} else if (!is_array($pSource)) {
|
} else if (!is_array($pSource)) {
|
||||||
throw new Exception('Invalid array parameter passed.');
|
throw new PHPExcel_Exception('Invalid array parameter passed.');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($pSource as $item) {
|
foreach ($pSource as $item) {
|
||||||
|
@ -78,12 +78,13 @@ class PHPExcel_NamedRange
|
|||||||
* @param string $pRange
|
* @param string $pRange
|
||||||
* @param bool $pLocalOnly
|
* @param bool $pLocalOnly
|
||||||
* @param PHPExcel_Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope.
|
* @param PHPExcel_Worksheet|null $pScope Scope. Only applies when $pLocalOnly = true. Null for global scope.
|
||||||
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
|
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
|
||||||
{
|
{
|
||||||
// Validate data
|
// Validate data
|
||||||
if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) {
|
if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) {
|
||||||
throw new Exception('Parameters can not be null.');
|
throw new PHPExcel_Exception('Parameters can not be null.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set local members
|
// Set local members
|
||||||
|
@ -131,34 +131,26 @@ class PHPExcel_Shared_OLERead {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$pos = $index = 0;
|
$pos = 0;
|
||||||
$this->bigBlockChain = array();
|
$this->bigBlockChain = '';
|
||||||
|
|
||||||
$bbs = self::BIG_BLOCK_SIZE / 4;
|
$bbs = self::BIG_BLOCK_SIZE / 4;
|
||||||
for ($i = 0; $i < $this->numBigBlockDepotBlocks; ++$i) {
|
for ($i = 0; $i < $this->numBigBlockDepotBlocks; ++$i) {
|
||||||
$pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE;
|
$pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE;
|
||||||
|
|
||||||
for ($j = 0 ; $j < $bbs; ++$j) {
|
$this->bigBlockChain .= substr($this->data, $pos, 4*$bbs);
|
||||||
$this->bigBlockChain[$index] = self::_GetInt4d($this->data, $pos);
|
$pos += 4*$bbs;
|
||||||
$pos += 4 ;
|
|
||||||
++$index;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$pos = $index = 0;
|
$pos = 0;
|
||||||
$sbdBlock = $this->sbdStartBlock;
|
$sbdBlock = $this->sbdStartBlock;
|
||||||
$this->smallBlockChain = array();
|
$this->smallBlockChain = '';
|
||||||
|
|
||||||
while ($sbdBlock != -2) {
|
while ($sbdBlock != -2) {
|
||||||
$pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE;
|
$pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE;
|
||||||
|
|
||||||
for ($j = 0; $j < $bbs; ++$j) {
|
$this->smallBlockChain .= substr($this->data, $pos, 4*$bbs);
|
||||||
$this->smallBlockChain[$index] = self::_GetInt4d($this->data, $pos);
|
$pos += 4*$bbs;
|
||||||
$pos += 4;
|
|
||||||
++$index;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sbdBlock = $this->bigBlockChain[$sbdBlock];
|
$sbdBlock = self::_GetInt4d($this->bigBlockChain, $sbdBlock*4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// read the directory stream
|
// read the directory stream
|
||||||
@ -190,7 +182,10 @@ class PHPExcel_Shared_OLERead {
|
|||||||
$pos = $block * self::SMALL_BLOCK_SIZE;
|
$pos = $block * self::SMALL_BLOCK_SIZE;
|
||||||
$streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE);
|
$streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE);
|
||||||
|
|
||||||
$block = $this->smallBlockChain[$block];
|
// $block = $this->smallBlockChain[$block];
|
||||||
|
// $block = unpack('l', substr($this->smallBlockChain, $block*4, 4));
|
||||||
|
// $block = $block[1];
|
||||||
|
$block = self::_GetInt4d($this->smallBlockChain, $block*4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $streamData;
|
return $streamData;
|
||||||
@ -207,7 +202,10 @@ class PHPExcel_Shared_OLERead {
|
|||||||
while ($block != -2) {
|
while ($block != -2) {
|
||||||
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
|
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
|
||||||
$streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
|
$streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
|
||||||
$block = $this->bigBlockChain[$block];
|
// $block = $this->bigBlockChain[$block];
|
||||||
|
// $block = unpack('l', substr($this->bigBlockChain, $block*4, 4));
|
||||||
|
// $block = $block[1];
|
||||||
|
$block = self::_GetInt4d($this->bigBlockChain, $block*4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $streamData;
|
return $streamData;
|
||||||
@ -228,7 +226,10 @@ class PHPExcel_Shared_OLERead {
|
|||||||
while ($block != -2) {
|
while ($block != -2) {
|
||||||
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
|
$pos = ($block + 1) * self::BIG_BLOCK_SIZE;
|
||||||
$data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
|
$data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE);
|
||||||
$block = $this->bigBlockChain[$block];
|
// $block = $this->bigBlockChain[$block];
|
||||||
|
// $block = unpack('l', substr($this->bigBlockChain, $block*4, 4));
|
||||||
|
// $block = $block[1];
|
||||||
|
$block = self::_GetInt4d($this->bigBlockChain, $block*4);
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -409,18 +409,18 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @param string $pValue The string to check
|
* @param string $pValue The string to check
|
||||||
* @return string The valid string
|
* @return string The valid string
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
*/
|
*/
|
||||||
private static function _checkSheetTitle($pValue)
|
private static function _checkSheetTitle($pValue)
|
||||||
{
|
{
|
||||||
// Some of the printable ASCII characters are invalid: * : / \ ? [ ]
|
// Some of the printable ASCII characters are invalid: * : / \ ? [ ]
|
||||||
if (str_replace(self::$_invalidCharacters, '', $pValue) !== $pValue) {
|
if (str_replace(self::$_invalidCharacters, '', $pValue) !== $pValue) {
|
||||||
throw new Exception('Invalid character found in sheet title');
|
throw new PHPExcel_Exception('Invalid character found in sheet title');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maximum 31 characters allowed for sheet title
|
// Maximum 31 characters allowed for sheet title
|
||||||
if (PHPExcel_Shared_String::CountCharacters($pValue) > 31) {
|
if (PHPExcel_Shared_String::CountCharacters($pValue) > 31) {
|
||||||
throw new Exception('Maximum 31 characters allowed in sheet title.');
|
throw new PHPExcel_Exception('Maximum 31 characters allowed in sheet title.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $pValue;
|
return $pValue;
|
||||||
@ -523,7 +523,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
* @param PHPExcel_Chart $pChart
|
* @param PHPExcel_Chart $pChart
|
||||||
* @param int|null $iChartIndex Index where chart should go (0,1,..., or null for last)
|
* @param int|null $iChartIndex Index where chart should go (0,1,..., or null for last)
|
||||||
* @return PHPExcel_Chart
|
* @return PHPExcel_Chart
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function addChart(PHPExcel_Chart $pChart = null, $iChartIndex = null)
|
public function addChart(PHPExcel_Chart $pChart = null, $iChartIndex = null)
|
||||||
{
|
{
|
||||||
@ -542,7 +541,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
* Return the count of charts on this worksheet
|
* Return the count of charts on this worksheet
|
||||||
*
|
*
|
||||||
* @return int The number of charts
|
* @return int The number of charts
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public function getChartCount()
|
public function getChartCount()
|
||||||
{
|
{
|
||||||
@ -1081,7 +1079,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
* Get cell at a specific coordinate
|
* Get cell at a specific coordinate
|
||||||
*
|
*
|
||||||
* @param string $pCoordinate Coordinate of the cell
|
* @param string $pCoordinate Coordinate of the cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Cell Cell that was found
|
* @return PHPExcel_Cell Cell that was found
|
||||||
*/
|
*/
|
||||||
public function getCell($pCoordinate = 'A1')
|
public function getCell($pCoordinate = 'A1')
|
||||||
@ -1111,9 +1109,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
$pCoordinate = strtoupper($pCoordinate);
|
$pCoordinate = strtoupper($pCoordinate);
|
||||||
|
|
||||||
if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) {
|
if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) {
|
||||||
throw new Exception('Cell coordinate can not be a range of cells.');
|
throw new PHPExcel_Exception('Cell coordinate can not be a range of cells.');
|
||||||
} elseif (strpos($pCoordinate,'$') !== false) {
|
} elseif (strpos($pCoordinate,'$') !== false) {
|
||||||
throw new Exception('Cell coordinate must not be absolute.');
|
throw new PHPExcel_Exception('Cell coordinate must not be absolute.');
|
||||||
} else {
|
} else {
|
||||||
// Create new cell object
|
// Create new cell object
|
||||||
|
|
||||||
@ -1178,7 +1176,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
* Cell at a specific coordinate exists?
|
* Cell at a specific coordinate exists?
|
||||||
*
|
*
|
||||||
* @param string $pCoordinate Coordinate of the cell
|
* @param string $pCoordinate Coordinate of the cell
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function cellExists($pCoordinate = 'A1')
|
public function cellExists($pCoordinate = 'A1')
|
||||||
@ -1210,9 +1208,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
$pCoordinate = strtoupper($pCoordinate);
|
$pCoordinate = strtoupper($pCoordinate);
|
||||||
|
|
||||||
if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) {
|
if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) {
|
||||||
throw new Exception('Cell coordinate can not be a range of cells.');
|
throw new PHPExcel_Exception('Cell coordinate can not be a range of cells.');
|
||||||
} elseif (strpos($pCoordinate,'$') !== false) {
|
} elseif (strpos($pCoordinate,'$') !== false) {
|
||||||
throw new Exception('Cell coordinate must not be absolute.');
|
throw new PHPExcel_Exception('Cell coordinate must not be absolute.');
|
||||||
} else {
|
} else {
|
||||||
// Coordinates
|
// Coordinates
|
||||||
$aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate);
|
$aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate);
|
||||||
@ -1508,14 +1506,14 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @param array of PHPExcel_Style_Conditional $pCellStyle Cell style to duplicate
|
* @param array of PHPExcel_Style_Conditional $pCellStyle Cell style to duplicate
|
||||||
* @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
|
* @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '')
|
public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '')
|
||||||
{
|
{
|
||||||
foreach($pCellStyle as $cellStyle) {
|
foreach($pCellStyle as $cellStyle) {
|
||||||
if (!($cellStyle instanceof PHPExcel_Style_Conditional)) {
|
if (!($cellStyle instanceof PHPExcel_Style_Conditional)) {
|
||||||
throw new Exception('Style is not a conditional style');
|
throw new PHPExcel_Exception('Style is not a conditional style');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1582,7 +1580,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @param string $pCell Cell coordinate (e.g. A1)
|
* @param string $pCell Cell coordinate (e.g. A1)
|
||||||
* @param int $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*)
|
* @param int $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*)
|
||||||
* @throws Exception
|
* @throws PHPExcel_Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setBreak($pCell = 'A1', $pBreak = PHPExcel_Worksheet::BREAK_NONE)
|
public function setBreak($pCell = 'A1', $pBreak = PHPExcel_Worksheet::BREAK_NONE)
|
||||||
@ -1593,7 +1591,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
if ($pCell != '') {
|
if ($pCell != '') {
|
||||||
$this->_breaks[$pCell] = $pBreak;
|
$this->_breaks[$pCell] = $pBreak;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('No cell coordinate specified.');
|
throw new PHPExcel_Exception('No cell coordinate specified.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -1605,7 +1603,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
* @param integer $pColumn Numeric column coordinate of the cell
|
* @param integer $pColumn Numeric column coordinate of the cell
|
||||||
* @param integer $pRow Numeric row coordinate of the cell
|
* @param integer $pRow Numeric row coordinate of the cell
|
||||||
* @param integer $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*)
|
* @param integer $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*)
|
||||||
* @throws Exception
|
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setBreakByColumnAndRow($pColumn = 0, $pRow = 1, $pBreak = PHPExcel_Worksheet::BREAK_NONE)
|
public function setBreakByColumnAndRow($pColumn = 0, $pRow = 1, $pBreak = PHPExcel_Worksheet::BREAK_NONE)
|
||||||
|
@ -1029,7 +1029,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||||||
// End row
|
// End row
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
$objWriter->flush();
|
// $objWriter->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
Loading…
Reference in New Issue
Block a user