upgrade to PHPExcel 1.7.2
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/WorksheetIterator.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel
|
class PHPExcel
|
||||||
{
|
{
|
||||||
@@ -212,6 +212,8 @@ class PHPExcel
|
|||||||
* Add sheet
|
* Add sheet
|
||||||
*
|
*
|
||||||
* @param PHPExcel_Worksheet $pSheet
|
* @param PHPExcel_Worksheet $pSheet
|
||||||
|
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
|
||||||
|
* @return PHPExcel_Worksheet
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function addSheet(PHPExcel_Worksheet $pSheet = null, $iSheetIndex = null)
|
public function addSheet(PHPExcel_Worksheet $pSheet = null, $iSheetIndex = null)
|
||||||
@@ -229,7 +231,14 @@ class PHPExcel
|
|||||||
0,
|
0,
|
||||||
array($pSheet)
|
array($pSheet)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Adjust active sheet index if necessary
|
||||||
|
if ($this->_activeSheetIndex >= $iSheetIndex) {
|
||||||
|
++$this->_activeSheetIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return $pSheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -390,10 +399,11 @@ class PHPExcel
|
|||||||
* Add external sheet
|
* Add external sheet
|
||||||
*
|
*
|
||||||
* @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)
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function addExternalSheet(PHPExcel_Worksheet $pSheet) {
|
public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) {
|
||||||
if (!is_null($this->getSheetByName($pSheet->getTitle()))) {
|
if (!is_null($this->getSheetByName($pSheet->getTitle()))) {
|
||||||
throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
|
throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
|
||||||
}
|
}
|
||||||
@@ -414,7 +424,7 @@ class PHPExcel
|
|||||||
$cell->setXfIndex( $cell->getXfIndex() + $countCellXfs );
|
$cell->setXfIndex( $cell->getXfIndex() + $countCellXfs );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->addSheet($pSheet);
|
return $this->addSheet($pSheet, $iSheetIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -700,7 +710,8 @@ class PHPExcel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells in the workbook
|
* Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells
|
||||||
|
* and columns in the workbook
|
||||||
*/
|
*/
|
||||||
public function garbageCollect()
|
public function garbageCollect()
|
||||||
{
|
{
|
||||||
@@ -711,12 +722,27 @@ class PHPExcel
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->getWorksheetIterator() as $sheet) {
|
foreach ($this->getWorksheetIterator() as $sheet) {
|
||||||
|
|
||||||
|
// from cells
|
||||||
foreach ($sheet->getCellCollection(false) as $cell) {
|
foreach ($sheet->getCellCollection(false) as $cell) {
|
||||||
++$countReferencesCellXf[$cell->getXfIndex()];
|
++$countReferencesCellXf[$cell->getXfIndex()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// from row dimensions
|
||||||
|
foreach ($sheet->getRowDimensions() as $rowDimension) {
|
||||||
|
if ($rowDimension->getXfIndex() !== null) {
|
||||||
|
++$countReferencesCellXf[$rowDimension->getXfIndex()];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove those cellXfs that have zero references and create mapping so we can update xfIndex for all cells
|
// from column dimensions
|
||||||
|
foreach ($sheet->getColumnDimensions() as $columnDimension) {
|
||||||
|
++$countReferencesCellXf[$columnDimension->getXfIndex()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove cellXfs without references and create mapping so we can update xfIndex
|
||||||
|
// for all cells and columns
|
||||||
$countNeededCellXfs = 0;
|
$countNeededCellXfs = 0;
|
||||||
foreach ($this->_cellXfCollection as $index => $cellXf) {
|
foreach ($this->_cellXfCollection as $index => $cellXf) {
|
||||||
if ($countReferencesCellXf[$index] > 0 || $index == 0) { // we must never remove the first cellXf
|
if ($countReferencesCellXf[$index] > 0 || $index == 0) { // we must never remove the first cellXf
|
||||||
@@ -728,16 +754,35 @@ class PHPExcel
|
|||||||
}
|
}
|
||||||
$this->_cellXfCollection = array_values($this->_cellXfCollection);
|
$this->_cellXfCollection = array_values($this->_cellXfCollection);
|
||||||
|
|
||||||
// if we removed the first style by accident, recreate it
|
// update the index for all cellXfs
|
||||||
|
foreach ($this->_cellXfCollection as $i => $cellXf) {
|
||||||
|
echo $cellXf->setIndex($i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure there is always at least one cellXf (there should be)
|
||||||
if (count($this->_cellXfCollection) == 0) {
|
if (count($this->_cellXfCollection) == 0) {
|
||||||
$this->_cellXfCollection[] = new PHPExcel_Style();
|
$this->_cellXfCollection[] = new PHPExcel_Style();
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the xfIndex for all cells
|
// update the xfIndex for all cells, row dimensions, column dimensions
|
||||||
foreach ($this->getWorksheetIterator() as $sheet) {
|
foreach ($this->getWorksheetIterator() as $sheet) {
|
||||||
|
|
||||||
|
// for all cells
|
||||||
foreach ($sheet->getCellCollection(false) as $cell) {
|
foreach ($sheet->getCellCollection(false) as $cell) {
|
||||||
$cell->setXfIndex( $map[$cell->getXfIndex()] );
|
$cell->setXfIndex( $map[$cell->getXfIndex()] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for all row dimensions
|
||||||
|
foreach ($sheet->getRowDimensions() as $rowDimension) {
|
||||||
|
if ($rowDimension->getXfIndex() !== null) {
|
||||||
|
$rowDimension->setXfIndex( $map[$rowDimension->getXfIndex()] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// for all column dimensions
|
||||||
|
foreach ($sheet->getColumnDimensions() as $columnDimension) {
|
||||||
|
$columnDimension->setXfIndex( $map[$columnDimension->getXfIndex()] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// also do garbage collection for all the sheets
|
// also do garbage collection for all the sheets
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_Exception extends Exception {
|
class PHPExcel_Calculation_Exception extends Exception {
|
||||||
/**
|
/**
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel root directory */
|
/** PHPExcel root directory */
|
||||||
@@ -41,7 +41,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation/Exception.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_ExceptionHandler {
|
class PHPExcel_Calculation_ExceptionHandler {
|
||||||
/**
|
/**
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation/FormulaToken.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_FormulaParser {
|
class PHPExcel_Calculation_FormulaParser {
|
||||||
/* Character constants */
|
/* Character constants */
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ PARTLY BASED ON:
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_FormulaToken {
|
class PHPExcel_Calculation_FormulaToken {
|
||||||
/* Token types */
|
/* Token types */
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Calculation
|
* @package PHPExcel_Calculation
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Calculation_Function {
|
class PHPExcel_Calculation_Function {
|
||||||
/* Function categories */
|
/* Function categories */
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Cell
|
class PHPExcel_Cell
|
||||||
{
|
{
|
||||||
@@ -136,11 +136,6 @@ class PHPExcel_Cell
|
|||||||
*/
|
*/
|
||||||
public function __construct($pColumn = 'A', $pRow = 1, $pValue = null, $pDataType = null, PHPExcel_Worksheet $pSheet = null)
|
public function __construct($pColumn = 'A', $pRow = 1, $pValue = null, $pDataType = null, PHPExcel_Worksheet $pSheet = null)
|
||||||
{
|
{
|
||||||
// Set value binder?
|
|
||||||
if (is_null(self::$_valueBinder)) {
|
|
||||||
self::$_valueBinder = new PHPExcel_Cell_DefaultValueBinder();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialise cell coordinate
|
// Initialise cell coordinate
|
||||||
$this->_column = strtoupper($pColumn);
|
$this->_column = strtoupper($pColumn);
|
||||||
$this->_row = $pRow;
|
$this->_row = $pRow;
|
||||||
@@ -171,7 +166,7 @@ class PHPExcel_Cell
|
|||||||
*/
|
*/
|
||||||
public function getColumn()
|
public function getColumn()
|
||||||
{
|
{
|
||||||
return strtoupper($this->_column);
|
return $this->_column;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -226,20 +221,40 @@ class PHPExcel_Cell
|
|||||||
* @param mixed $pValue Value
|
* @param mixed $pValue Value
|
||||||
* @param string $pDataType Explicit data type
|
* @param string $pDataType Explicit data type
|
||||||
* @return PHPExcel_Cell
|
* @return PHPExcel_Cell
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function setValueExplicit($pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING)
|
public function setValueExplicit($pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING)
|
||||||
{
|
{
|
||||||
// check strings that they are ok
|
// set the value according to data type
|
||||||
// TODO: fix also for RichText
|
switch ($pDataType) {
|
||||||
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING && !($pValue instanceof PHPExcel_RichText)) {
|
case PHPExcel_Cell_DataType::TYPE_STRING:
|
||||||
// string must never be longer than 32,767 characters, truncate if necessary
|
case PHPExcel_Cell_DataType::TYPE_NULL:
|
||||||
$pValue = PHPExcel_Shared_String::Substring($pValue, 0, 32767);
|
case PHPExcel_Cell_DataType::TYPE_INLINE:
|
||||||
|
$this->_value = PHPExcel_Cell_DataType::checkString($pValue);
|
||||||
|
break;
|
||||||
|
|
||||||
// we require that newline is represented as "\n" in core, not as "\r\n" or "\r"
|
case PHPExcel_Cell_DataType::TYPE_NUMERIC:
|
||||||
$pValue = str_replace(array("\r\n", "\r"), "\n", $pValue);
|
$this->_value = (float)$pValue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PHPExcel_Cell_DataType::TYPE_FORMULA:
|
||||||
|
$this->_value = (string)$pValue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PHPExcel_Cell_DataType::TYPE_BOOL:
|
||||||
|
$this->_value = (bool)$pValue;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PHPExcel_Cell_DataType::TYPE_ERROR:
|
||||||
|
$this->_value = PHPExcel_Cell_DataType::checkErrorCode($pValue);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Exception('Invalid datatype: ' . $pDataType);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_value = $pValue;
|
// set the datatype
|
||||||
$this->_dataType = $pDataType;
|
$this->_dataType = $pDataType;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -492,22 +507,17 @@ class PHPExcel_Cell
|
|||||||
{
|
{
|
||||||
if (strpos($pCoordinateString,':') !== false) {
|
if (strpos($pCoordinateString,':') !== false) {
|
||||||
throw new Exception('Cell coordinate string can not be a range of cells.');
|
throw new Exception('Cell coordinate string can not be a range of cells.');
|
||||||
|
|
||||||
} else if ($pCoordinateString == '') {
|
} else if ($pCoordinateString == '') {
|
||||||
throw new Exception('Cell coordinate can not be zero-length string.');
|
throw new Exception('Cell coordinate can not be zero-length string.');
|
||||||
} else {
|
|
||||||
// Column
|
|
||||||
$column = '';
|
|
||||||
|
|
||||||
// Row
|
} else if (preg_match("/([$]?[A-Z]+)([$]?\d+)/", $pCoordinateString, $matches)) {
|
||||||
$row = '';
|
|
||||||
|
|
||||||
// Convert a cell reference
|
|
||||||
if (preg_match("/([$]?[A-Z]+)([$]?\d+)/", $pCoordinateString, $matches)) {
|
|
||||||
list(, $column, $row) = $matches;
|
list(, $column, $row) = $matches;
|
||||||
}
|
|
||||||
|
|
||||||
// Return array
|
|
||||||
return array($column, $row);
|
return array($column, $row);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw new Exception('Invalid cell coordinate.');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -745,6 +755,10 @@ class PHPExcel_Cell
|
|||||||
* @return PHPExcel_Cell_IValueBinder
|
* @return PHPExcel_Cell_IValueBinder
|
||||||
*/
|
*/
|
||||||
public static function getValueBinder() {
|
public static function getValueBinder() {
|
||||||
|
if (is_null(self::$_valueBinder)) {
|
||||||
|
self::$_valueBinder = new PHPExcel_Cell_DefaultValueBinder();
|
||||||
|
}
|
||||||
|
|
||||||
return self::$_valueBinder;
|
return self::$_valueBinder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||||
{
|
{
|
||||||
@@ -125,20 +125,6 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Style logic - Numbers
|
|
||||||
if ($dataType === PHPExcel_Cell_DataType::TYPE_NUMERIC) {
|
|
||||||
// Leading zeroes?
|
|
||||||
if (preg_match('/^\-?[0]+[0-9]*\.?[0-9]*$/', $value)) {
|
|
||||||
// Convert value to string
|
|
||||||
$cell->setValueExplicit( $value, PHPExcel_Cell_DataType::TYPE_STRING);
|
|
||||||
|
|
||||||
// Set style
|
|
||||||
$cell->getParent()->getStyle( $cell->getCoordinate() )->getNumberFormat()->setFormatCode( PHPExcel_Style_NumberFormat::FORMAT_TEXT );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not bound yet? Use parent...
|
// Not bound yet? Use parent...
|
||||||
return parent::bindValue($cell, $value);
|
return parent::bindValue($cell, $value);
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Cell/DefaultValueBinder.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Cell_DataType
|
class PHPExcel_Cell_DataType
|
||||||
{
|
{
|
||||||
@@ -82,4 +82,44 @@ class PHPExcel_Cell_DataType
|
|||||||
public static function dataTypeForValue($pValue = null) {
|
public static function dataTypeForValue($pValue = null) {
|
||||||
return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue);
|
return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check a string that it satisfies Excel requirements
|
||||||
|
*
|
||||||
|
* @param mixed Value to sanitize to an Excel string
|
||||||
|
* @return mixed Sanitized value
|
||||||
|
*/
|
||||||
|
public static function checkString($pValue = null)
|
||||||
|
{
|
||||||
|
if ($pValue instanceof PHPExcel_RichText) {
|
||||||
|
// TODO: Sanitize Rich-Text string (max. character count is 32,767)
|
||||||
|
return $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// string must never be longer than 32,767 characters, truncate if necessary
|
||||||
|
$pValue = PHPExcel_Shared_String::Substring($pValue, 0, 32767);
|
||||||
|
|
||||||
|
// we require that newline is represented as "\n" in core, not as "\r\n" or "\r"
|
||||||
|
$pValue = str_replace(array("\r\n", "\r"), "\n", $pValue);
|
||||||
|
|
||||||
|
return $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check a value that it is a valid error code
|
||||||
|
*
|
||||||
|
* @param mixed Value to sanitize to an Excel error code
|
||||||
|
* @return string Sanitized value
|
||||||
|
*/
|
||||||
|
public static function checkErrorCode($pValue = null)
|
||||||
|
{
|
||||||
|
$pValue = (string)$pValue;
|
||||||
|
|
||||||
|
if ( !array_key_exists($pValue, self::$_errorCodes) ) {
|
||||||
|
$pValue = '#NULL!';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Cell_DataValidation
|
class PHPExcel_Cell_DataValidation
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||||
{
|
{
|
||||||
@@ -87,22 +87,31 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
|||||||
// Match the value against a few data types
|
// Match the value against a few data types
|
||||||
if (is_null($pValue)) {
|
if (is_null($pValue)) {
|
||||||
return PHPExcel_Cell_DataType::TYPE_NULL;
|
return PHPExcel_Cell_DataType::TYPE_NULL;
|
||||||
|
|
||||||
} elseif ($pValue === '') {
|
} elseif ($pValue === '') {
|
||||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||||
|
|
||||||
} elseif ($pValue instanceof PHPExcel_RichText) {
|
} elseif ($pValue instanceof PHPExcel_RichText) {
|
||||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||||
|
|
||||||
} elseif ($pValue{0} === '=') {
|
} elseif ($pValue{0} === '=') {
|
||||||
return PHPExcel_Cell_DataType::TYPE_FORMULA;
|
return PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||||
|
|
||||||
} elseif (is_bool($pValue)) {
|
} elseif (is_bool($pValue)) {
|
||||||
return PHPExcel_Cell_DataType::TYPE_BOOL;
|
return PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||||
|
|
||||||
} elseif (is_float($pValue) || is_int($pValue)) {
|
} elseif (is_float($pValue) || is_int($pValue)) {
|
||||||
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||||
} elseif (preg_match('/^\-?[0-9]*\\.?[0-9]*$/', $pValue)) {
|
|
||||||
|
} elseif (preg_match('/^\-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)$/', $pValue)) {
|
||||||
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||||
|
|
||||||
} elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) {
|
} elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) {
|
||||||
return PHPExcel_Cell_DataType::TYPE_ERROR;
|
return PHPExcel_Cell_DataType::TYPE_ERROR;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Cell_Hyperlink
|
class PHPExcel_Cell_Hyperlink
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Cell
|
* @package PHPExcel_Cell
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
interface PHPExcel_Cell_IValueBinder
|
interface PHPExcel_Cell_IValueBinder
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Comment implements PHPExcel_IComparable
|
class PHPExcel_Comment implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -290,37 +290,6 @@ class PHPExcel_Comment implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_DocumentProperties
|
class PHPExcel_DocumentProperties
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PasswordHasher.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_DocumentSecurity
|
class PHPExcel_DocumentSecurity
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_HashTable
|
class PHPExcel_HashTable
|
||||||
{
|
{
|
||||||
@@ -101,25 +101,9 @@ class PHPExcel_HashTable
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function add(PHPExcel_IComparable $pSource = null) {
|
public function add(PHPExcel_IComparable $pSource = null) {
|
||||||
// Determine hashcode
|
if (!isset($this->_items[ $pSource->getHashCode() ])) {
|
||||||
$hashCode = null;
|
$this->_items[ $pSource->getHashCode() ] = $pSource;
|
||||||
$hashIndex = $pSource->getHashIndex();
|
$this->_keyMap[ count($this->_items) - 1 ] = $pSource->getHashCode();
|
||||||
if ( is_null ( $hashIndex ) ) {
|
|
||||||
$hashCode = $pSource->getHashCode();
|
|
||||||
} else if ( isset ( $this->_keyMap[$hashIndex] ) ) {
|
|
||||||
$hashCode = $this->_keyMap[$hashIndex];
|
|
||||||
} else {
|
|
||||||
$hashCode = $pSource->getHashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add value
|
|
||||||
if (!isset($this->_items[ $hashCode ])) {
|
|
||||||
$this->_items[ $hashCode ] = $pSource;
|
|
||||||
$index = count($this->_items) - 1;
|
|
||||||
$this->_keyMap[ $index ] = $hashCode;
|
|
||||||
$pSource->setHashIndex( $index );
|
|
||||||
} else {
|
|
||||||
$pSource->setHashIndex( $this->_items[ $hashCode ]->getHashIndex() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,9 +18,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
interface PHPExcel_IComparable
|
interface PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -40,23 +40,4 @@ interface PHPExcel_IComparable
|
|||||||
*/
|
*/
|
||||||
public function getHashCode();
|
public function getHashCode();
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value);
|
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/IReader.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_IOFactory
|
class PHPExcel_IOFactory
|
||||||
{
|
{
|
||||||
@@ -71,8 +71,11 @@ class PHPExcel_IOFactory
|
|||||||
private static $_autoResolveClasses = array(
|
private static $_autoResolveClasses = array(
|
||||||
'Excel2007',
|
'Excel2007',
|
||||||
'Excel5',
|
'Excel5',
|
||||||
|
'Excel2003XML',
|
||||||
|
'OOCalc',
|
||||||
|
'SYLK',
|
||||||
'Serialized',
|
'Serialized',
|
||||||
'CSV'
|
'CSV',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -193,9 +196,55 @@ class PHPExcel_IOFactory
|
|||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFileName
|
||||||
* @return PHPExcel_Reader_IReader
|
* @return PHPExcel_Reader_IReader
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static function createReaderForFile($pFilename) {
|
public static function createReaderForFile($pFilename) {
|
||||||
|
|
||||||
|
// First, lucky guess by inspecting file extension
|
||||||
|
$pathinfo = pathinfo($pFilename);
|
||||||
|
|
||||||
|
if (isset($pathinfo['extension'])) {
|
||||||
|
|
||||||
|
switch (strtolower($pathinfo['extension'])) {
|
||||||
|
case 'xlsx':
|
||||||
|
$reader = self::createReader('Excel2007');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'xls':
|
||||||
|
$reader = self::createReader('Excel5');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ods':
|
||||||
|
$reader = self::createReader('OOCalc');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'slk':
|
||||||
|
$reader = self::createReader('SYLK');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'xml':
|
||||||
|
$reader = self::createReader('Excel2003XML');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'csv':
|
||||||
|
// Do nothing
|
||||||
|
// We must not try to use CSV reader since it loads
|
||||||
|
// all files including Excel files etc.
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let's see if we are lucky
|
||||||
|
if ($reader->canRead($pFilename)) {
|
||||||
|
return $reader;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we reach here then "lucky guess" didn't give any result
|
||||||
|
|
||||||
// Try loading using self::$_autoResolveClasses
|
// Try loading using self::$_autoResolveClasses
|
||||||
foreach (self::$_autoResolveClasses as $autoResolveClass) {
|
foreach (self::$_autoResolveClasses as $autoResolveClass) {
|
||||||
$reader = self::createReader($autoResolveClass);
|
$reader = self::createReader($autoResolveClass);
|
||||||
@@ -204,6 +253,5 @@ class PHPExcel_IOFactory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception("Could not automatically determine PHPExcel_Reader_IReader for file.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/ReferenceHelper.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_NamedRange
|
class PHPExcel_NamedRange
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -55,10 +55,17 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/DefaultReadFilter.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Input encoding
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_inputEncoding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delimiter
|
* Delimiter
|
||||||
*
|
*
|
||||||
@@ -98,6 +105,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
* Create a new PHPExcel_Reader_CSV
|
* Create a new PHPExcel_Reader_CSV
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
$this->_inputEncoding = 'UTF-8';
|
||||||
$this->_delimiter = ',';
|
$this->_delimiter = ',';
|
||||||
$this->_enclosure = '"';
|
$this->_enclosure = '"';
|
||||||
$this->_lineEnding = PHP_EOL;
|
$this->_lineEnding = PHP_EOL;
|
||||||
@@ -118,8 +126,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if it is a CSV file (using file name)
|
return true;
|
||||||
return (substr(strtolower($pFilename), -3) == 'csv');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -155,6 +162,26 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
$this->_readFilter = $pValue;
|
$this->_readFilter = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set input encoding
|
||||||
|
*
|
||||||
|
* @param string $pValue Input encoding
|
||||||
|
*/
|
||||||
|
public function setInputEncoding($pValue = 'UTF-8')
|
||||||
|
{
|
||||||
|
$this->_inputEncoding = $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get input encoding
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getInputEncoding()
|
||||||
|
{
|
||||||
|
return $this->_inputEncoding;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file into PHPExcel instance
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
*
|
*
|
||||||
@@ -181,7 +208,18 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
throw new Exception("Could not open file $pFilename for reading.");
|
throw new Exception("Could not open file $pFilename for reading.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop trough file
|
// Skip BOM, if any
|
||||||
|
switch ($this->_inputEncoding) {
|
||||||
|
case 'UTF-8':
|
||||||
|
fgets($fileHandle, 4) == "\xEF\xBB\xBF" ?
|
||||||
|
fseek($fileHandle, 3) : fseek($fileHandle, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop through file
|
||||||
$currentRow = 0;
|
$currentRow = 0;
|
||||||
$rowData = array();
|
$rowData = array();
|
||||||
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) {
|
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) {
|
||||||
@@ -194,6 +232,11 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
$rowData[$i] = str_replace("\\" . $this->_enclosure, $this->_enclosure, $rowData[$i]);
|
$rowData[$i] = str_replace("\\" . $this->_enclosure, $this->_enclosure, $rowData[$i]);
|
||||||
$rowData[$i] = str_replace($this->_enclosure . $this->_enclosure, $this->_enclosure, $rowData[$i]);
|
$rowData[$i] = str_replace($this->_enclosure . $this->_enclosure, $this->_enclosure, $rowData[$i]);
|
||||||
|
|
||||||
|
// Convert encoding if necessary
|
||||||
|
if ($this->_inputEncoding !== 'UTF-8') {
|
||||||
|
$rowData[$i] = PHPExcel_Shared_String::ConvertEncoding($rowData[$i], 'UTF-8', $this->_inputEncoding);
|
||||||
|
}
|
||||||
|
|
||||||
// Set cell value
|
// Set cell value
|
||||||
$objPHPExcel->getActiveSheet()->setCellValue(
|
$objPHPExcel->getActiveSheet()->setCellValue(
|
||||||
$columnLetter . $currentRow, $rowData[$i]
|
$columnLetter . $currentRow, $rowData[$i]
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/IReadFilter.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
|
class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
|
||||||
{
|
{
|
||||||
|
698
libraries/PHPExcel/PHPExcel/Reader/Excel2003XML.php
Normal file
698
libraries/PHPExcel/PHPExcel/Reader/Excel2003XML.php
Normal file
@@ -0,0 +1,698 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader
|
||||||
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version 1.7.2, 2010-01-11
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** PHPExcel root directory */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** PHPExcel */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Reader_IReader */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/IReader.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Worksheet */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Cell */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Calculation */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Reader_DefaultReadFilter */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/DefaultReadFilter.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Reader_Excel2003XML
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader
|
||||||
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Read data only?
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_readDataOnly = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restict which sheets should be loaded?
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $_loadSheetsOnly = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sheet index to read
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $_sheetIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $_styles = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Reader_IReadFilter instance
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Reader_IReadFilter
|
||||||
|
*/
|
||||||
|
private $_readFilter = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data only?
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getReadDataOnly() {
|
||||||
|
return $this->_readDataOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set read data only
|
||||||
|
*
|
||||||
|
* @param boolean $pValue
|
||||||
|
* @return PHPExcel_Reader_Excel2007
|
||||||
|
*/
|
||||||
|
public function setReadDataOnly($pValue = false) {
|
||||||
|
$this->_readDataOnly = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get which sheets to load
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getLoadSheetsOnly()
|
||||||
|
{
|
||||||
|
return $this->_loadSheetsOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set which sheets to load
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
* @return PHPExcel_Reader_Excel2007
|
||||||
|
*/
|
||||||
|
public function setLoadSheetsOnly($value = null)
|
||||||
|
{
|
||||||
|
$this->_loadSheetsOnly = is_array($value) ?
|
||||||
|
$value : array($value);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set all sheets to load
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Reader_Excel2007
|
||||||
|
*/
|
||||||
|
public function setLoadAllSheets()
|
||||||
|
{
|
||||||
|
$this->_loadSheetsOnly = null;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read filter
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Reader_IReadFilter
|
||||||
|
*/
|
||||||
|
public function getReadFilter() {
|
||||||
|
return $this->_readFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set read filter
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||||
|
* @return PHPExcel_Reader_Excel2007
|
||||||
|
*/
|
||||||
|
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||||
|
$this->_readFilter = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Reader_Excel2003XML
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->_sheetIndex = 0;
|
||||||
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
|
*
|
||||||
|
* @param string $pFileName
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function canRead($pFilename)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Office xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||||
|
// Excel xmlns:x="urn:schemas-microsoft-com:office:excel"
|
||||||
|
// XML Spreadsheet xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
|
||||||
|
// Spreadsheet component xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet"
|
||||||
|
// XML schema xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
|
||||||
|
// XML data type xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
|
||||||
|
// MS-persist recordset xmlns:rs="urn:schemas-microsoft-com:rowset"
|
||||||
|
// Rowset xmlns:z="#RowsetSchema"
|
||||||
|
//
|
||||||
|
|
||||||
|
$signature = array(
|
||||||
|
'<?xml version="1.0"?>',
|
||||||
|
'<?mso-application progid="Excel.Sheet"?>'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read sample data (first 2 KB will do)
|
||||||
|
$fh = fopen($pFilename, 'r');
|
||||||
|
$data = fread($fh, 2048);
|
||||||
|
fclose($fh);
|
||||||
|
|
||||||
|
$headers = explode("\n",$data);
|
||||||
|
$valid = true;
|
||||||
|
foreach($signature as $key => $match) {
|
||||||
|
if (isset($headers[$key])) {
|
||||||
|
$line = trim(rtrim($headers[$key], "\r\n"));
|
||||||
|
if ($line != $match) {
|
||||||
|
$valid = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$valid = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads PHPExcel from file
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function load($pFilename)
|
||||||
|
{
|
||||||
|
// Create new PHPExcel
|
||||||
|
$objPHPExcel = new PHPExcel();
|
||||||
|
|
||||||
|
// Load into this instance
|
||||||
|
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) {
|
||||||
|
$styleAttributeValue = strtolower($styleAttributeValue);
|
||||||
|
foreach($styleList as $style) {
|
||||||
|
if ($styleAttributeValue == strtolower($style)) {
|
||||||
|
$styleAttributeValue = $style;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pixel units to excel width units(units of 1/256th of a character width)
|
||||||
|
* @param pxs
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static function _pixel2WidthUnits($pxs) {
|
||||||
|
$UNIT_OFFSET_MAP = array(0, 36, 73, 109, 146, 182, 219);
|
||||||
|
|
||||||
|
$widthUnits = 256 * ($pxs / 7);
|
||||||
|
$widthUnits += $UNIT_OFFSET_MAP[($pxs % 7)];
|
||||||
|
return $widthUnits;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* excel width units(units of 1/256th of a character width) to pixel units
|
||||||
|
* @param widthUnits
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static function _widthUnits2Pixel($widthUnits) {
|
||||||
|
$pixels = ($widthUnits / 256) * 7;
|
||||||
|
$offsetWidthUnits = $widthUnits % 256;
|
||||||
|
$pixels += round($offsetWidthUnits / (256 / 7));
|
||||||
|
return $pixels;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @param PHPExcel $objPHPExcel
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
|
{
|
||||||
|
$fromFormats = array('\-', '\ ');
|
||||||
|
$toFormats = array('-', ' ');
|
||||||
|
|
||||||
|
$underlineStyles = array (
|
||||||
|
PHPExcel_Style_Font::UNDERLINE_NONE,
|
||||||
|
PHPExcel_Style_Font::UNDERLINE_DOUBLE,
|
||||||
|
PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING,
|
||||||
|
PHPExcel_Style_Font::UNDERLINE_SINGLE,
|
||||||
|
PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING
|
||||||
|
);
|
||||||
|
$verticalAlignmentStyles = array (
|
||||||
|
PHPExcel_Style_Alignment::VERTICAL_BOTTOM,
|
||||||
|
PHPExcel_Style_Alignment::VERTICAL_TOP,
|
||||||
|
PHPExcel_Style_Alignment::VERTICAL_CENTER,
|
||||||
|
PHPExcel_Style_Alignment::VERTICAL_JUSTIFY
|
||||||
|
);
|
||||||
|
$horizontalAlignmentStyles = array (
|
||||||
|
PHPExcel_Style_Alignment::HORIZONTAL_GENERAL,
|
||||||
|
PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
|
||||||
|
PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
|
||||||
|
PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
|
||||||
|
PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS,
|
||||||
|
PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$xml = simplexml_load_file($pFilename);
|
||||||
|
$namespaces = $xml->getNamespaces(true);
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($namespaces);
|
||||||
|
// echo '</pre><hr />';
|
||||||
|
//
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($xml);
|
||||||
|
// echo '</pre><hr />';
|
||||||
|
//
|
||||||
|
$docProps = $objPHPExcel->getProperties();
|
||||||
|
foreach($xml->DocumentProperties[0] as $propertyName => $propertyValue) {
|
||||||
|
switch ($propertyName) {
|
||||||
|
case 'Title' :
|
||||||
|
$docProps->setTitle($propertyValue);
|
||||||
|
break;
|
||||||
|
case 'Subject' :
|
||||||
|
$docProps->setSubject($propertyValue);
|
||||||
|
break;
|
||||||
|
case 'Author' :
|
||||||
|
$docProps->setCreator($propertyValue);
|
||||||
|
break;
|
||||||
|
case 'Created' :
|
||||||
|
$creationDate = strtotime($propertyValue);
|
||||||
|
$docProps->setCreated($creationDate);
|
||||||
|
break;
|
||||||
|
case 'LastAuthor' :
|
||||||
|
$docProps->setLastModifiedBy($propertyValue);
|
||||||
|
break;
|
||||||
|
case 'Company' :
|
||||||
|
$docProps->setCompany($propertyValue);
|
||||||
|
break;
|
||||||
|
case 'Category' :
|
||||||
|
$docProps->setCategory($propertyValue);
|
||||||
|
break;
|
||||||
|
case 'Keywords' :
|
||||||
|
$docProps->setKeywords($propertyValue);
|
||||||
|
break;
|
||||||
|
case 'Description' :
|
||||||
|
$docProps->setDescription($propertyValue);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach($xml->Styles[0] as $style) {
|
||||||
|
$style_ss = $style->attributes($namespaces['ss']);
|
||||||
|
$styleID = (string) $style_ss['ID'];
|
||||||
|
// echo 'Style ID = '.$styleID.'<br />';
|
||||||
|
if ($styleID == 'Default') {
|
||||||
|
$this->_styles['Default'] = array();
|
||||||
|
} else {
|
||||||
|
$this->_styles[$styleID] = $this->_styles['Default'];
|
||||||
|
}
|
||||||
|
foreach ($style as $styleType => $styleData) {
|
||||||
|
$styleAttributes = $styleData->attributes($namespaces['ss']);
|
||||||
|
// echo $styleType.'<br />';
|
||||||
|
switch ($styleType) {
|
||||||
|
case 'Alignment' :
|
||||||
|
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||||
|
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||||
|
$styleAttributeValue = (string) $styleAttributeValue;
|
||||||
|
switch ($styleAttributeKey) {
|
||||||
|
case 'Vertical' :
|
||||||
|
if (self::identifyFixedStyleValue($verticalAlignmentStyles,$styleAttributeValue)) {
|
||||||
|
$this->_styles[$styleID]['alignment']['vertical'] = $styleAttributeValue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'Horizontal' :
|
||||||
|
if (self::identifyFixedStyleValue($horizontalAlignmentStyles,$styleAttributeValue)) {
|
||||||
|
$this->_styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'WrapText' :
|
||||||
|
$this->_styles[$styleID]['alignment']['wrap'] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'Borders' :
|
||||||
|
foreach($styleData->Border as $borderStyle) {
|
||||||
|
$borderAttributes = $borderStyle->attributes($namespaces['ss']);
|
||||||
|
$thisBorder = array();
|
||||||
|
foreach($borderAttributes as $borderStyleKey => $borderStyleValue) {
|
||||||
|
// echo $borderStyleKey.' = '.$borderStyleValue.'<br />';
|
||||||
|
switch ($borderStyleKey) {
|
||||||
|
case 'LineStyle' :
|
||||||
|
$thisBorder['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
|
||||||
|
// $thisBorder['style'] = $borderStyleValue;
|
||||||
|
break;
|
||||||
|
case 'Weight' :
|
||||||
|
// $thisBorder['style'] = $borderStyleValue;
|
||||||
|
break;
|
||||||
|
case 'Position' :
|
||||||
|
$borderPosition = strtolower($borderStyleValue);
|
||||||
|
break;
|
||||||
|
case 'Color' :
|
||||||
|
$borderColour = substr($borderStyleValue,1);
|
||||||
|
$thisBorder['color']['rgb'] = $borderColour;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($thisBorder) > 0) {
|
||||||
|
if (($borderPosition == 'left') || ($borderPosition == 'right') || ($borderPosition == 'top') || ($borderPosition == 'bottom')) {
|
||||||
|
$this->_styles[$styleID]['borders'][$borderPosition] = $thisBorder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'Font' :
|
||||||
|
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||||
|
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||||
|
$styleAttributeValue = (string) $styleAttributeValue;
|
||||||
|
switch ($styleAttributeKey) {
|
||||||
|
case 'FontName' :
|
||||||
|
$this->_styles[$styleID]['font']['name'] = $styleAttributeValue;
|
||||||
|
break;
|
||||||
|
case 'Size' :
|
||||||
|
$this->_styles[$styleID]['font']['size'] = $styleAttributeValue;
|
||||||
|
break;
|
||||||
|
case 'Color' :
|
||||||
|
$this->_styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue,1);
|
||||||
|
break;
|
||||||
|
case 'Bold' :
|
||||||
|
$this->_styles[$styleID]['font']['bold'] = true;
|
||||||
|
break;
|
||||||
|
case 'Italic' :
|
||||||
|
$this->_styles[$styleID]['font']['italic'] = true;
|
||||||
|
break;
|
||||||
|
case 'Underline' :
|
||||||
|
if (self::identifyFixedStyleValue($underlineStyles,$styleAttributeValue)) {
|
||||||
|
$this->_styles[$styleID]['font']['underline'] = $styleAttributeValue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'Interior' :
|
||||||
|
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||||
|
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||||
|
switch ($styleAttributeKey) {
|
||||||
|
case 'Color' :
|
||||||
|
$this->_styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue,1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'NumberFormat' :
|
||||||
|
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||||
|
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||||
|
$styleAttributeValue = str_replace($fromFormats,$toFormats,$styleAttributeValue);
|
||||||
|
switch ($styleAttributeValue) {
|
||||||
|
case 'Short Date' :
|
||||||
|
$styleAttributeValue = 'dd/mm/yyyy';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ($styleAttributeValue > '') {
|
||||||
|
$this->_styles[$styleID]['numberformat']['code'] = $styleAttributeValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'Protection' :
|
||||||
|
foreach($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
|
||||||
|
// echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// print_r($this->_styles[$styleID]);
|
||||||
|
// echo '<hr />';
|
||||||
|
}
|
||||||
|
// echo '<hr />';
|
||||||
|
|
||||||
|
$worksheetID = 0;
|
||||||
|
foreach($xml->Worksheet as $worksheet) {
|
||||||
|
$worksheet_ss = $worksheet->attributes($namespaces['ss']);
|
||||||
|
if ((isset($this->_loadSheetsOnly)) && (isset($worksheet_ss['Name'])) &&
|
||||||
|
(!in_array($worksheet_ss['Name'], $this->_loadSheetsOnly))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new Worksheet
|
||||||
|
$objPHPExcel->createSheet();
|
||||||
|
$objPHPExcel->setActiveSheetIndex($worksheetID);
|
||||||
|
if (isset($worksheet_ss['Name'])) {
|
||||||
|
$worksheetName = $worksheet_ss['Name'];
|
||||||
|
$objPHPExcel->getActiveSheet()->setTitle($worksheetName);
|
||||||
|
}
|
||||||
|
|
||||||
|
$columnID = 'A';
|
||||||
|
foreach($worksheet->Table->Column as $columnData) {
|
||||||
|
$columnData_ss = $columnData->attributes($namespaces['ss']);
|
||||||
|
if (isset($columnData_ss['Index'])) {
|
||||||
|
$columnID = PHPExcel_Cell::stringFromColumnIndex($columnData_ss['Index']-1);
|
||||||
|
}
|
||||||
|
if (isset($columnData_ss['Width'])) {
|
||||||
|
$columnWidth = $columnData_ss['Width'];
|
||||||
|
// echo '<b>Setting column width for '.$columnID.' to '.$columnWidth.'</b><br />';
|
||||||
|
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setWidth($columnWidth / 5.4);
|
||||||
|
}
|
||||||
|
++$columnID;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowID = 1;
|
||||||
|
foreach($worksheet->Table->Row as $rowData) {
|
||||||
|
$row_ss = $rowData->attributes($namespaces['ss']);
|
||||||
|
if (isset($row_ss['Index'])) {
|
||||||
|
$rowID = (integer) $row_ss['Index'];
|
||||||
|
}
|
||||||
|
// echo '<b>Row '.$rowID.'</b><br />';
|
||||||
|
if (isset($row_ss['StyleID'])) {
|
||||||
|
$rowStyle = $row_ss['StyleID'];
|
||||||
|
}
|
||||||
|
if (isset($row_ss['Height'])) {
|
||||||
|
$rowHeight = $row_ss['Height'];
|
||||||
|
// echo '<b>Setting row height to '.$rowHeight.'</b><br />';
|
||||||
|
$objPHPExcel->getActiveSheet()->getRowDimension($rowID)->setRowHeight($rowHeight);
|
||||||
|
}
|
||||||
|
$columnID = 'A';
|
||||||
|
foreach($rowData->Cell as $cell) {
|
||||||
|
|
||||||
|
$cell_ss = $cell->attributes($namespaces['ss']);
|
||||||
|
if (isset($cell_ss['Index'])) {
|
||||||
|
$columnID = PHPExcel_Cell::stringFromColumnIndex($cell_ss['Index']-1);
|
||||||
|
}
|
||||||
|
$cellRange = $columnID.$rowID;
|
||||||
|
|
||||||
|
if ((isset($cell_ss['MergeAcross'])) || (isset($cell_ss['MergeDown']))) {
|
||||||
|
$columnTo = $columnID;
|
||||||
|
if (isset($cell_ss['MergeAcross'])) {
|
||||||
|
$columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1);
|
||||||
|
}
|
||||||
|
$rowTo = $rowID;
|
||||||
|
if (isset($cell_ss['MergeDown'])) {
|
||||||
|
$rowTo = $rowTo + $cell_ss['MergeDown'];
|
||||||
|
}
|
||||||
|
$cellRange .= ':'.$columnTo.$rowTo;
|
||||||
|
$objPHPExcel->getActiveSheet()->mergeCells($cellRange);
|
||||||
|
}
|
||||||
|
|
||||||
|
$hasCalculatedValue = false;
|
||||||
|
$cellDataFormula = '';
|
||||||
|
if (isset($cell_ss['Formula'])) {
|
||||||
|
$cellDataFormula = $cell_ss['Formula'];
|
||||||
|
$hasCalculatedValue = true;
|
||||||
|
}
|
||||||
|
if (isset($cell->Data)) {
|
||||||
|
$cellValue = $cellData = $cell->Data;
|
||||||
|
$type = PHPExcel_Cell_DataType::TYPE_NULL;
|
||||||
|
$cellData_ss = $cellData->attributes($namespaces['ss']);
|
||||||
|
if (isset($cellData_ss['Type'])) {
|
||||||
|
$cellDataType = $cellData_ss['Type'];
|
||||||
|
switch ($cellDataType) {
|
||||||
|
/*
|
||||||
|
const TYPE_STRING = 's';
|
||||||
|
const TYPE_FORMULA = 'f';
|
||||||
|
const TYPE_NUMERIC = 'n';
|
||||||
|
const TYPE_BOOL = 'b';
|
||||||
|
const TYPE_NULL = 's';
|
||||||
|
const TYPE_INLINE = 'inlineStr';
|
||||||
|
const TYPE_ERROR = 'e';
|
||||||
|
*/
|
||||||
|
case 'String' :
|
||||||
|
$type = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||||
|
break;
|
||||||
|
case 'Number' :
|
||||||
|
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||||
|
$cellValue = (float) $cellValue;
|
||||||
|
if (floor($cellValue) == $cellValue) {
|
||||||
|
$cellValue = (integer) $cellValue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'Boolean' :
|
||||||
|
$type = PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||||
|
$cellValue = ($cellValue != 0);
|
||||||
|
break;
|
||||||
|
case 'DateTime' :
|
||||||
|
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||||
|
$cellValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellValue));
|
||||||
|
break;
|
||||||
|
case 'Error' :
|
||||||
|
$type = PHPExcel_Cell_DataType::TYPE_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($hasCalculatedValue) {
|
||||||
|
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||||
|
$columnNumber = PHPExcel_Cell::columnIndexFromString($columnID);
|
||||||
|
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
||||||
|
$temp = explode('"',$cellDataFormula);
|
||||||
|
foreach($temp as $key => &$value) {
|
||||||
|
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||||
|
if (($key % 2) == 0) {
|
||||||
|
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/',$value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||||
|
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
|
||||||
|
// through the formula from left to right. Reversing means that we work right to left.through
|
||||||
|
// the formula
|
||||||
|
$cellReferences = array_reverse($cellReferences);
|
||||||
|
// Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
|
||||||
|
// then modify the formula to use that new reference
|
||||||
|
foreach($cellReferences as $cellReference) {
|
||||||
|
$rowReference = $cellReference[2][0];
|
||||||
|
// Empty R reference is the current row
|
||||||
|
if ($rowReference == '') $rowReference = $rowID;
|
||||||
|
// Bracketed R references are relative to the current row
|
||||||
|
if ($rowReference{0} == '[') $rowReference = $rowID + trim($rowReference,'[]');
|
||||||
|
$columnReference = $cellReference[4][0];
|
||||||
|
// Empty C reference is the current column
|
||||||
|
if ($columnReference == '') $columnReference = $columnNumber;
|
||||||
|
// Bracketed C references are relative to the current column
|
||||||
|
if ($columnReference{0} == '[') $columnReference = $columnNumber + trim($columnReference,'[]');
|
||||||
|
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
||||||
|
$value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($value);
|
||||||
|
// Then rebuild the formula string
|
||||||
|
$cellDataFormula = implode('"',$temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// echo 'Cell '.$columnID.$rowID.' is a '.$type.' with a value of '.(($hasCalculatedValue) ? $cellDataFormula : $cellValue).'<br />';
|
||||||
|
//
|
||||||
|
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue),$type);
|
||||||
|
if ($hasCalculatedValue) {
|
||||||
|
// echo 'Forumla result is '.$cellValue.'<br />';
|
||||||
|
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($cellValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($cell_ss['StyleID'])) {
|
||||||
|
$style = (string) $cell_ss['StyleID'];
|
||||||
|
// echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />';
|
||||||
|
if ((isset($this->_styles[$style])) && (count($this->_styles[$style]) > 0)) {
|
||||||
|
// echo 'Cell '.$columnID.$rowID.'<br />';
|
||||||
|
// print_r($this->_styles[$style]);
|
||||||
|
// echo '<br />';
|
||||||
|
if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) {
|
||||||
|
$objPHPExcel->getActiveSheet()->setCellValue($columnID.$rowID,NULL);
|
||||||
|
}
|
||||||
|
$objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->_styles[$style]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
++$columnID;
|
||||||
|
}
|
||||||
|
++$rowID;
|
||||||
|
}
|
||||||
|
++$worksheetID;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return $objPHPExcel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get sheet index
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getSheetIndex() {
|
||||||
|
return $this->_sheetIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set sheet index
|
||||||
|
*
|
||||||
|
* @param int $pValue Sheet index
|
||||||
|
* @return PHPExcel_Reader_Excel2003XML
|
||||||
|
*/
|
||||||
|
public function setSheetIndex($pValue = 0) {
|
||||||
|
$this->_sheetIndex = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/DefaultReadFilter.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||||
{
|
{
|
||||||
@@ -217,7 +217,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
$zip = new ZipArchive;
|
$zip = new ZipArchive;
|
||||||
if ($zip->open($pFilename) === true) {
|
if ($zip->open($pFilename) === true) {
|
||||||
// check if it is an OOXML archive
|
// check if it is an OOXML archive
|
||||||
$rels = simplexml_load_string($zip->getFromName("_rels/.rels"));
|
$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels"));
|
||||||
|
|
||||||
$zip->close();
|
$zip->close();
|
||||||
|
|
||||||
@@ -227,7 +227,6 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function _castToBool($c) {
|
private function _castToBool($c) {
|
||||||
// echo 'Initial Cast to Boolean<br />';
|
// echo 'Initial Cast to Boolean<br />';
|
||||||
$value = isset($c->v) ? (string) $c->v : null;
|
$value = isset($c->v) ? (string) $c->v : null;
|
||||||
@@ -300,6 +299,32 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function _getFromZipArchive(ZipArchive $archive, $fileName = '')
|
||||||
|
{
|
||||||
|
// Root-relative paths
|
||||||
|
if (strpos($fileName, '//') !== false)
|
||||||
|
{
|
||||||
|
$fileName = substr($fileName, strpos($fileName, '//') + 1);
|
||||||
|
}
|
||||||
|
$fileName = PHPExcel_Shared_File::realpath($fileName);
|
||||||
|
|
||||||
|
// Apache POI fixes
|
||||||
|
$contents = $archive->getFromName($fileName);
|
||||||
|
if ($contents === false)
|
||||||
|
{
|
||||||
|
$contents = $archive->getFromName(substr($fileName, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (strpos($contents, '<?xml') !== false && strpos($contents, '<?xml') !== 0)
|
||||||
|
{
|
||||||
|
$contents = substr($contents, strpos($contents, '<?xml'));
|
||||||
|
}
|
||||||
|
var_dump($fileName);
|
||||||
|
var_dump($contents);
|
||||||
|
*/
|
||||||
|
return $contents;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
@@ -324,14 +349,11 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
$zip = new ZipArchive;
|
$zip = new ZipArchive;
|
||||||
$zip->open($pFilename);
|
$zip->open($pFilename);
|
||||||
|
|
||||||
$rels = simplexml_load_string($zip->getFromName("_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
||||||
foreach ($rels->Relationship as $rel) {
|
foreach ($rels->Relationship as $rel) {
|
||||||
switch ($rel["Type"]) {
|
switch ($rel["Type"]) {
|
||||||
case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties":
|
case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties":
|
||||||
$xmlCore = simplexml_load_string($zip->getFromName("{$rel['Target']}"));
|
$xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"));
|
||||||
if ($xmlCore === false) { // Apache POI hack
|
|
||||||
$xmlCore = simplexml_load_string($zip->getFromName(substr("{$rel['Target']}", 1)));
|
|
||||||
}
|
|
||||||
if ($xmlCore) {
|
if ($xmlCore) {
|
||||||
$xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/");
|
$xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/");
|
||||||
$xmlCore->registerXPathNamespace("dcterms", "http://purl.org/dc/terms/");
|
$xmlCore->registerXPathNamespace("dcterms", "http://purl.org/dc/terms/");
|
||||||
@@ -351,15 +373,12 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
|
||||||
$dir = dirname($rel["Target"]);
|
$dir = dirname($rel["Target"]);
|
||||||
$relsWorkbook = simplexml_load_string($zip->getFromName("$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
||||||
if ($relsWorkbook === false) { // Apache POI hack
|
|
||||||
$relsWorkbook = simplexml_load_string($zip->getFromName(substr("$dir/_rels/" . basename($rel["Target"]) . ".rels", 1))); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
||||||
}
|
|
||||||
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
|
||||||
|
|
||||||
$sharedStrings = array();
|
$sharedStrings = array();
|
||||||
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']"));
|
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']"));
|
||||||
$xmlStrings = simplexml_load_string($zip->getFromName("$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
$xmlStrings = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||||
if (isset($xmlStrings) && isset($xmlStrings->si)) {
|
if (isset($xmlStrings) && isset($xmlStrings->si)) {
|
||||||
foreach ($xmlStrings->si as $val) {
|
foreach ($xmlStrings->si as $val) {
|
||||||
if (isset($val->t)) {
|
if (isset($val->t)) {
|
||||||
@@ -380,7 +399,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
$styles = array();
|
$styles = array();
|
||||||
$cellStyles = array();
|
$cellStyles = array();
|
||||||
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
|
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
|
||||||
$xmlStyles = simplexml_load_string($zip->getFromName("$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
$xmlStyles = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||||
$numFmts = null;
|
$numFmts = null;
|
||||||
if ($xmlStyles && $xmlStyles->numFmts[0]) {
|
if ($xmlStyles && $xmlStyles->numFmts[0]) {
|
||||||
$numFmts = $xmlStyles->numFmts[0];
|
$numFmts = $xmlStyles->numFmts[0];
|
||||||
@@ -415,12 +434,6 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
"border" => $xmlStyles->borders->border[intval($xf["borderId"])],
|
"border" => $xmlStyles->borders->border[intval($xf["borderId"])],
|
||||||
"alignment" => $xf->alignment,
|
"alignment" => $xf->alignment,
|
||||||
"protection" => $xf->protection,
|
"protection" => $xf->protection,
|
||||||
"applyAlignment" => (isset($xf["applyAlignment"]) && ((string)$xf["applyAlignment"] == 'true' || (string)$xf["applyAlignment"] == '1')),
|
|
||||||
"applyBorder" => (isset($xf["applyBorder"]) && ((string)$xf["applyBorder"] == 'true' || (string)$xf["applyBorder"] == '1')),
|
|
||||||
"applyFill" => (isset($xf["applyFill"]) && ((string)$xf["applyFill"] == 'true' || (string)$xf["applyFill"] == '1')),
|
|
||||||
"applyFont" => (isset($xf["applyFont"]) && ((string)$xf["applyFont"] == 'true' || (string)$xf["applyFont"] == '1')),
|
|
||||||
"applyNumberFormat" => (isset($xf["applyNumberFormat"]) && ((string)$xf["applyNumberFormat"] == 'true' || (string)$xf["applyNumberFormat"] == '1')),
|
|
||||||
"applyProtection" => (isset($xf["applyProtection"]) && ((string)$xf["applyProtection"] == 'true' || (string)$xf["applyProtection"] == '1'))
|
|
||||||
);
|
);
|
||||||
$styles[] = $style;
|
$styles[] = $style;
|
||||||
|
|
||||||
@@ -448,12 +461,6 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
"border" => $xmlStyles->borders->border[intval($xf["borderId"])],
|
"border" => $xmlStyles->borders->border[intval($xf["borderId"])],
|
||||||
"alignment" => $xf->alignment,
|
"alignment" => $xf->alignment,
|
||||||
"protection" => $xf->protection,
|
"protection" => $xf->protection,
|
||||||
"applyAlignment" => true,
|
|
||||||
"applyBorder" => true,
|
|
||||||
"applyFill" => true,
|
|
||||||
"applyFont" => true,
|
|
||||||
"applyNumberFormat" => true,
|
|
||||||
"applyProtection" => true
|
|
||||||
);
|
);
|
||||||
$cellStyles[] = $cellStyle;
|
$cellStyles[] = $cellStyle;
|
||||||
|
|
||||||
@@ -466,12 +473,16 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
$dxfs = array();
|
$dxfs = array();
|
||||||
if (!$this->_readDataOnly && $xmlStyles) {
|
if (!$this->_readDataOnly && $xmlStyles) {
|
||||||
|
if ($xmlStyles->dxfs) {
|
||||||
foreach ($xmlStyles->dxfs->dxf as $dxf) {
|
foreach ($xmlStyles->dxfs->dxf as $dxf) {
|
||||||
$style = new PHPExcel_Style;
|
$style = new PHPExcel_Style;
|
||||||
$this->_readStyle($style, $dxf);
|
$this->_readStyle($style, $dxf);
|
||||||
$dxfs[] = $style;
|
$dxfs[] = $style;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($xmlStyles->cellStyles)
|
||||||
|
{
|
||||||
foreach ($xmlStyles->cellStyles->cellStyle as $cellStyle) {
|
foreach ($xmlStyles->cellStyles->cellStyle as $cellStyle) {
|
||||||
if (intval($cellStyle['builtinId']) == 0) {
|
if (intval($cellStyle['builtinId']) == 0) {
|
||||||
if (isset($cellStyles[intval($cellStyle['xfId'])])) {
|
if (isset($cellStyles[intval($cellStyle['xfId'])])) {
|
||||||
@@ -484,11 +495,10 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$xmlWorkbook = simplexml_load_string($zip->getFromName("{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
||||||
if ($xmlWorkbook === false) { // Apache POI hack
|
|
||||||
$xmlWorkbook = simplexml_load_string($zip->getFromName(substr("{$rel['Target']}", 1))); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||||
|
|
||||||
// Set base date
|
// Set base date
|
||||||
if ($xmlWorkbook->workbookPr) {
|
if ($xmlWorkbook->workbookPr) {
|
||||||
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
|
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
|
||||||
@@ -505,6 +515,8 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
$countSkippedSheets = 0; // keep track of number of skipped sheets
|
$countSkippedSheets = 0; // keep track of number of skipped sheets
|
||||||
$mapSheetId = array(); // mapping of sheet ids from old to new
|
$mapSheetId = array(); // mapping of sheet ids from old to new
|
||||||
|
|
||||||
|
if ($xmlWorkbook->sheets)
|
||||||
|
{
|
||||||
foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
|
foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
|
||||||
++$oldSheetId;
|
++$oldSheetId;
|
||||||
|
|
||||||
@@ -523,10 +535,14 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
$docSheet = $excel->createSheet();
|
$docSheet = $excel->createSheet();
|
||||||
$docSheet->setTitle((string) $eleSheet["name"]);
|
$docSheet->setTitle((string) $eleSheet["name"]);
|
||||||
$fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
$fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
||||||
$xmlSheet = simplexml_load_string($zip->getFromName("$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
$xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||||
|
|
||||||
$sharedFormulas = array();
|
$sharedFormulas = array();
|
||||||
|
|
||||||
|
if (isset($eleSheet["state"]) && (string) $eleSheet["state"] != '') {
|
||||||
|
$docSheet->setSheetState( (string) $eleSheet["state"] );
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($xmlSheet->sheetViews) && isset($xmlSheet->sheetViews->sheetView)) {
|
if (isset($xmlSheet->sheetViews) && isset($xmlSheet->sheetViews->sheetView)) {
|
||||||
if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) {
|
if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) {
|
||||||
$docSheet->getSheetView()->setZoomScale( intval($xmlSheet->sheetViews->sheetView['zoomScale']) );
|
$docSheet->getSheetView()->setZoomScale( intval($xmlSheet->sheetViews->sheetView['zoomScale']) );
|
||||||
@@ -562,6 +578,22 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
$docSheet->freezePaneByColumnAndRow($xSplit, $ySplit);
|
$docSheet->freezePaneByColumnAndRow($xSplit, $ySplit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($xmlSheet->sheetViews->sheetView->selection)) {
|
||||||
|
if (isset($xmlSheet->sheetViews->sheetView->selection['sqref'])) {
|
||||||
|
$sqref = (string)$xmlSheet->sheetViews->sheetView->selection['sqref'];
|
||||||
|
$sqref = explode(' ', $sqref);
|
||||||
|
$sqref = $sqref[0];
|
||||||
|
$docSheet->setSelectedCells($sqref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->tabColor)) {
|
||||||
|
if (isset($xmlSheet->sheetPr->tabColor['rgb'])) {
|
||||||
|
$docSheet->getTabColor()->setARGB( (string)$xmlSheet->sheetPr->tabColor['rgb'] );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->outlinePr)) {
|
if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->outlinePr)) {
|
||||||
@@ -578,6 +610,14 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->pageSetUpPr)) {
|
||||||
|
if (isset($xmlSheet->sheetPr->pageSetUpPr['fitToPage']) && $xmlSheet->sheetPr->pageSetUpPr['fitToPage'] == false) {
|
||||||
|
$docSheet->getPageSetup()->setFitToPage(false);
|
||||||
|
} else {
|
||||||
|
$docSheet->getPageSetup()->setFitToPage(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($xmlSheet->sheetFormatPr)) {
|
if (isset($xmlSheet->sheetFormatPr)) {
|
||||||
if (isset($xmlSheet->sheetFormatPr['customHeight']) && ((string)$xmlSheet->sheetFormatPr['customHeight'] == '1' || strtolower((string)$xmlSheet->sheetFormatPr['customHeight']) == 'true') && isset($xmlSheet->sheetFormatPr['defaultRowHeight'])) {
|
if (isset($xmlSheet->sheetFormatPr['customHeight']) && ((string)$xmlSheet->sheetFormatPr['customHeight'] == '1' || strtolower((string)$xmlSheet->sheetFormatPr['customHeight']) == 'true') && isset($xmlSheet->sheetFormatPr['defaultRowHeight'])) {
|
||||||
$docSheet->getDefaultRowDimension()->setRowHeight( (float)$xmlSheet->sheetFormatPr['defaultRowHeight'] );
|
$docSheet->getDefaultRowDimension()->setRowHeight( (float)$xmlSheet->sheetFormatPr['defaultRowHeight'] );
|
||||||
@@ -590,6 +630,9 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
if (isset($xmlSheet->cols) && !$this->_readDataOnly) {
|
if (isset($xmlSheet->cols) && !$this->_readDataOnly) {
|
||||||
foreach ($xmlSheet->cols->col as $col) {
|
foreach ($xmlSheet->cols->col as $col) {
|
||||||
for ($i = intval($col["min"]) - 1; $i < intval($col["max"]); ++$i) {
|
for ($i = intval($col["min"]) - 1; $i < intval($col["max"]); ++$i) {
|
||||||
|
if ($col["style"]) {
|
||||||
|
$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setXfIndex(intval($col["style"]));
|
||||||
|
}
|
||||||
if ($col["bestFit"]) {
|
if ($col["bestFit"]) {
|
||||||
$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setAutoSize(true);
|
$docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setAutoSize(true);
|
||||||
}
|
}
|
||||||
@@ -642,6 +685,9 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
if ($row["outlineLevel"] > 0) {
|
if ($row["outlineLevel"] > 0) {
|
||||||
$docSheet->getRowDimension(intval($row["r"]))->setOutlineLevel(intval($row["outlineLevel"]));
|
$docSheet->getRowDimension(intval($row["r"]))->setOutlineLevel(intval($row["outlineLevel"]));
|
||||||
}
|
}
|
||||||
|
if ($row["s"]) {
|
||||||
|
$docSheet->getRowDimension(intval($row["r"]))->setXfIndex(intval($row["s"]));
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($row->c as $c) {
|
foreach ($row->c as $c) {
|
||||||
$r = (string) $c["r"];
|
$r = (string) $c["r"];
|
||||||
@@ -654,19 +700,19 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
$coordinates = PHPExcel_Cell::coordinateFromString($r);
|
$coordinates = PHPExcel_Cell::coordinateFromString($r);
|
||||||
|
|
||||||
if (!$this->getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) {
|
if (!$this->getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) {
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// echo '<b>Reading cell '.$coordinates[0].$coordinates[1].'</b><br />';
|
// echo '<b>Reading cell '.$coordinates[0].$coordinates[1].'</b><br />';
|
||||||
// print_r($c);
|
// print_r($c);
|
||||||
// echo '<br />';
|
// echo '<br />';
|
||||||
// echo 'Cell Data Type is '.$cellDataType.': ';
|
// echo 'Cell Data Type is '.$cellDataType.': ';
|
||||||
//
|
//
|
||||||
// Read cell!
|
// Read cell!
|
||||||
switch ($cellDataType) {
|
switch ($cellDataType) {
|
||||||
case "s":
|
case "s":
|
||||||
// echo 'String<br />';
|
// echo 'String<br />';
|
||||||
if ((string)$c->v != '') {
|
if ((string)$c->v != '') {
|
||||||
$value = $sharedStrings[intval($c->v)];
|
$value = $sharedStrings[intval($c->v)];
|
||||||
|
|
||||||
@@ -679,47 +725,47 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case "b":
|
case "b":
|
||||||
// echo 'Boolean<br />';
|
// echo 'Boolean<br />';
|
||||||
if (!isset($c->f)) {
|
if (!isset($c->f)) {
|
||||||
$value = $this->_castToBool($c);
|
$value = $this->_castToBool($c);
|
||||||
} else {
|
} else {
|
||||||
// Formula
|
// Formula
|
||||||
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToBool');
|
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToBool');
|
||||||
// echo '$calculatedValue = '.$calculatedValue.'<br />';
|
// echo '$calculatedValue = '.$calculatedValue.'<br />';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "inlineStr":
|
case "inlineStr":
|
||||||
// echo 'Inline String<br />';
|
// echo 'Inline String<br />';
|
||||||
$value = $this->_parseRichText($c->is);
|
$value = $this->_parseRichText($c->is);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "e":
|
case "e":
|
||||||
// echo 'Error<br />';
|
// echo 'Error<br />';
|
||||||
if (!isset($c->f)) {
|
if (!isset($c->f)) {
|
||||||
$value = $this->_castToError($c);
|
$value = $this->_castToError($c);
|
||||||
} else {
|
} else {
|
||||||
// Formula
|
// Formula
|
||||||
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToError');
|
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToError');
|
||||||
// echo '$calculatedValue = '.$calculatedValue.'<br />';
|
// echo '$calculatedValue = '.$calculatedValue.'<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// echo 'Default<br />';
|
// echo 'Default<br />';
|
||||||
if (!isset($c->f)) {
|
if (!isset($c->f)) {
|
||||||
// echo 'Not a Formula<br />';
|
// echo 'Not a Formula<br />';
|
||||||
$value = $this->_castToString($c);
|
$value = $this->_castToString($c);
|
||||||
} else {
|
} else {
|
||||||
// echo 'Treat as Formula<br />';
|
// echo 'Treat as Formula<br />';
|
||||||
// Formula
|
// Formula
|
||||||
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToString');
|
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToString');
|
||||||
// echo '$calculatedValue = '.$calculatedValue.'<br />';
|
// echo '$calculatedValue = '.$calculatedValue.'<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// echo 'Value is '.$value.'<br />';
|
// echo 'Value is '.$value.'<br />';
|
||||||
|
|
||||||
// Check for numeric values
|
// Check for numeric values
|
||||||
if (is_numeric($value) && $cellDataType != 's') {
|
if (is_numeric($value) && $cellDataType != 's') {
|
||||||
@@ -852,13 +898,17 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
$docPageSetup->setPaperSize(intval($xmlSheet->pageSetup["paperSize"]));
|
$docPageSetup->setPaperSize(intval($xmlSheet->pageSetup["paperSize"]));
|
||||||
}
|
}
|
||||||
if (isset($xmlSheet->pageSetup["scale"])) {
|
if (isset($xmlSheet->pageSetup["scale"])) {
|
||||||
$docPageSetup->setScale(intval($xmlSheet->pageSetup["scale"]));
|
$docPageSetup->setScale(intval($xmlSheet->pageSetup["scale"]), false);
|
||||||
}
|
}
|
||||||
if (isset($xmlSheet->pageSetup["fitToHeight"]) && intval($xmlSheet->pageSetup["fitToHeight"]) > 0) {
|
if (isset($xmlSheet->pageSetup["fitToHeight"]) && intval($xmlSheet->pageSetup["fitToHeight"]) >= 0) {
|
||||||
$docPageSetup->setFitToHeight(intval($xmlSheet->pageSetup["fitToHeight"]));
|
$docPageSetup->setFitToHeight(intval($xmlSheet->pageSetup["fitToHeight"]), false);
|
||||||
}
|
}
|
||||||
if (isset($xmlSheet->pageSetup["fitToWidth"]) && intval($xmlSheet->pageSetup["fitToWidth"]) > 0) {
|
if (isset($xmlSheet->pageSetup["fitToWidth"]) && intval($xmlSheet->pageSetup["fitToWidth"]) >= 0) {
|
||||||
$docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup["fitToWidth"]));
|
$docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup["fitToWidth"]), false);
|
||||||
|
}
|
||||||
|
if (isset($xmlSheet->pageSetup["firstPageNumber"]) && isset($xmlSheet->pageSetup["useFirstPageNumber"]) &&
|
||||||
|
((string)$xmlSheet->pageSetup["useFirstPageNumber"] == 'true' || (string)$xmlSheet->pageSetup["useFirstPageNumber"] == '1')) {
|
||||||
|
$docPageSetup->setFirstPageNumber(intval($xmlSheet->pageSetup["firstPageNumber"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -945,7 +995,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
if (!$this->_readDataOnly) {
|
if (!$this->_readDataOnly) {
|
||||||
// Locate hyperlink relations
|
// Locate hyperlink relations
|
||||||
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
||||||
$relsWorksheet = simplexml_load_string($zip->getFromName( dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
||||||
foreach ($relsWorksheet->Relationship as $ele) {
|
foreach ($relsWorksheet->Relationship as $ele) {
|
||||||
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") {
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") {
|
||||||
$hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"];
|
$hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"];
|
||||||
@@ -953,7 +1003,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop trough hyperlinks
|
// Loop through hyperlinks
|
||||||
if ($xmlSheet && $xmlSheet->hyperlinks) {
|
if ($xmlSheet && $xmlSheet->hyperlinks) {
|
||||||
foreach ($xmlSheet->hyperlinks->hyperlink as $hyperlink) {
|
foreach ($xmlSheet->hyperlinks->hyperlink as $hyperlink) {
|
||||||
// Link url
|
// Link url
|
||||||
@@ -982,7 +1032,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
if (!$this->_readDataOnly) {
|
if (!$this->_readDataOnly) {
|
||||||
// Locate comment relations
|
// Locate comment relations
|
||||||
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
||||||
$relsWorksheet = simplexml_load_string($zip->getFromName( dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
||||||
foreach ($relsWorksheet->Relationship as $ele) {
|
foreach ($relsWorksheet->Relationship as $ele) {
|
||||||
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") {
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") {
|
||||||
$comments[(string)$ele["Id"]] = (string)$ele["Target"];
|
$comments[(string)$ele["Id"]] = (string)$ele["Target"];
|
||||||
@@ -993,32 +1043,32 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop trough comments
|
// Loop through comments
|
||||||
foreach ($comments as $relName => $relPath) {
|
foreach ($comments as $relName => $relPath) {
|
||||||
// Load comments file
|
// Load comments file
|
||||||
$relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
|
$relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
|
||||||
$commentsFile = simplexml_load_string($zip->getFromName($relPath) );
|
$commentsFile = simplexml_load_string($this->_getFromZipArchive($zip, $relPath) );
|
||||||
|
|
||||||
// Utility variables
|
// Utility variables
|
||||||
$authors = array();
|
$authors = array();
|
||||||
|
|
||||||
// Loop trough authors
|
// Loop through authors
|
||||||
foreach ($commentsFile->authors->author as $author) {
|
foreach ($commentsFile->authors->author as $author) {
|
||||||
$authors[] = (string)$author;
|
$authors[] = (string)$author;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop trough contents
|
// Loop through contents
|
||||||
foreach ($commentsFile->commentList->comment as $comment) {
|
foreach ($commentsFile->commentList->comment as $comment) {
|
||||||
$docSheet->getComment( (string)$comment['ref'] )->setAuthor( $authors[(string)$comment['authorId']] );
|
$docSheet->getComment( (string)$comment['ref'] )->setAuthor( $authors[(string)$comment['authorId']] );
|
||||||
$docSheet->getComment( (string)$comment['ref'] )->setText( $this->_parseRichText($comment->text) );
|
$docSheet->getComment( (string)$comment['ref'] )->setText( $this->_parseRichText($comment->text) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop trough VML comments
|
// Loop through VML comments
|
||||||
foreach ($vmlComments as $relName => $relPath) {
|
foreach ($vmlComments as $relName => $relPath) {
|
||||||
// Load VML comments file
|
// Load VML comments file
|
||||||
$relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
|
$relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
|
||||||
$vmlCommentsFile = simplexml_load_string( $zip->getFromName($relPath) );
|
$vmlCommentsFile = simplexml_load_string( $this->_getFromZipArchive($zip, $relPath) );
|
||||||
$vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
|
$vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
|
||||||
|
|
||||||
$shapes = $vmlCommentsFile->xpath('//v:shape');
|
$shapes = $vmlCommentsFile->xpath('//v:shape');
|
||||||
@@ -1069,7 +1119,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
// Header/footer images
|
// Header/footer images
|
||||||
if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) {
|
if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) {
|
||||||
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
||||||
$relsWorksheet = simplexml_load_string($zip->getFromName( dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
||||||
$vmlRelationship = '';
|
$vmlRelationship = '';
|
||||||
|
|
||||||
foreach ($relsWorksheet->Relationship as $ele) {
|
foreach ($relsWorksheet->Relationship as $ele) {
|
||||||
@@ -1080,7 +1130,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
if ($vmlRelationship != '') {
|
if ($vmlRelationship != '') {
|
||||||
// Fetch linked images
|
// Fetch linked images
|
||||||
$relsVML = simplexml_load_string($zip->getFromName( dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels' )); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsVML = simplexml_load_string($this->_getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels' )); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
||||||
$drawings = array();
|
$drawings = array();
|
||||||
foreach ($relsVML->Relationship as $ele) {
|
foreach ($relsVML->Relationship as $ele) {
|
||||||
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
|
||||||
@@ -1089,7 +1139,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch VML document
|
// Fetch VML document
|
||||||
$vmlDrawing = simplexml_load_string($zip->getFromName($vmlRelationship));
|
$vmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $vmlRelationship));
|
||||||
$vmlDrawing->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
|
$vmlDrawing->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
|
||||||
|
|
||||||
$hfImages = array();
|
$hfImages = array();
|
||||||
@@ -1124,9 +1174,9 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make sure drawings and graph are loaded differently!
|
// TODO: Make sure drawings and graph are loaded differently!
|
||||||
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
||||||
$relsWorksheet = simplexml_load_string($zip->getFromName( dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
||||||
$drawings = array();
|
$drawings = array();
|
||||||
foreach ($relsWorksheet->Relationship as $ele) {
|
foreach ($relsWorksheet->Relationship as $ele) {
|
||||||
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") {
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") {
|
||||||
@@ -1136,7 +1186,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
if ($xmlSheet->drawing && !$this->_readDataOnly) {
|
if ($xmlSheet->drawing && !$this->_readDataOnly) {
|
||||||
foreach ($xmlSheet->drawing as $drawing) {
|
foreach ($xmlSheet->drawing as $drawing) {
|
||||||
$fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
$fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
||||||
$relsDrawing = simplexml_load_string($zip->getFromName( dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsDrawing = simplexml_load_string($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
||||||
$images = array();
|
$images = array();
|
||||||
|
|
||||||
if ($relsDrawing && $relsDrawing->Relationship) {
|
if ($relsDrawing && $relsDrawing->Relationship) {
|
||||||
@@ -1146,7 +1196,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$xmlDrawing = simplexml_load_string($zip->getFromName($fileDrawing))->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
|
$xmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $fileDrawing))->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
|
||||||
|
|
||||||
if ($xmlDrawing->oneCellAnchor) {
|
if ($xmlDrawing->oneCellAnchor) {
|
||||||
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
|
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
|
||||||
@@ -1221,7 +1271,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop trough definedNames
|
// Loop through definedNames
|
||||||
if ($xmlWorkbook->definedNames) {
|
if ($xmlWorkbook->definedNames) {
|
||||||
foreach ($xmlWorkbook->definedNames->definedName as $definedName) {
|
foreach ($xmlWorkbook->definedNames->definedName as $definedName) {
|
||||||
// Extract range
|
// Extract range
|
||||||
@@ -1316,15 +1366,20 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
// Next sheet id
|
// Next sheet id
|
||||||
++$sheetId;
|
++$sheetId;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->_readDataOnly) {
|
if (!$this->_readDataOnly) {
|
||||||
// active sheet index
|
// active sheet index
|
||||||
$activeTab = intval($xmlWorkbook->bookViews->workbookView["activeTab"]); // refers to old sheet index
|
$activeTab = intval($xmlWorkbook->bookViews->workbookView["activeTab"]); // refers to old sheet index
|
||||||
|
|
||||||
// keep active sheet index if sheet is still loaded, else first sheet is set as the active
|
// keep active sheet index if sheet is still loaded, else first sheet is set as the active
|
||||||
if ($mapSheetId[$activeTab] !== null) {
|
if (isset($mapSheetId[$activeTab]) && $mapSheetId[$activeTab] !== null) {
|
||||||
$excel->setActiveSheetIndex($mapSheetId[$activeTab]);
|
$excel->setActiveSheetIndex($mapSheetId[$activeTab]);
|
||||||
} else {
|
} else {
|
||||||
|
if ($excel->getSheetCount() == 0)
|
||||||
|
{
|
||||||
|
$excel->createSheet();
|
||||||
|
}
|
||||||
$excel->setActiveSheetIndex(0);
|
$excel->setActiveSheetIndex(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1346,7 +1401,9 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
private function _readStyle($docStyle, $style) {
|
private function _readStyle($docStyle, $style) {
|
||||||
// format code
|
// format code
|
||||||
if ($style->applyNumberFormat) $docStyle->getNumberFormat()->setFormatCode($style->numFmt);
|
if (isset($style->numFmt)) {
|
||||||
|
$docStyle->getNumberFormat()->setFormatCode($style->numFmt);
|
||||||
|
}
|
||||||
|
|
||||||
// font
|
// font
|
||||||
if (isset($style->font)) {
|
if (isset($style->font)) {
|
||||||
@@ -1381,7 +1438,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fill
|
// fill
|
||||||
if (isset($style->fill) && ($style->applyFill || $style instanceof SimpleXMLElement)) {
|
if (isset($style->fill)) {
|
||||||
if ($style->fill->gradientFill) {
|
if ($style->fill->gradientFill) {
|
||||||
$gradientFill = $style->fill->gradientFill[0];
|
$gradientFill = $style->fill->gradientFill[0];
|
||||||
$docStyle->getFill()->setFillType((string) $gradientFill["type"]);
|
$docStyle->getFill()->setFillType((string) $gradientFill["type"]);
|
||||||
@@ -1404,11 +1461,23 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
// border
|
// border
|
||||||
if (isset($style->border) && ($style->applyBorder || $style instanceof SimpleXMLElement)) {
|
if (isset($style->border)) {
|
||||||
if ($style->border["diagonalUp"] == 'true') {
|
$diagonalUp = false;
|
||||||
|
$diagonalDown = false;
|
||||||
|
if ($style->border["diagonalUp"] == 'true' || $style->border["diagonalUp"] == 1) {
|
||||||
|
$diagonalUp = true;
|
||||||
|
}
|
||||||
|
if ($style->border["diagonalDown"] == 'true' || $style->border["diagonalDown"] == 1) {
|
||||||
|
$diagonalDown = true;
|
||||||
|
}
|
||||||
|
if ($diagonalUp == false && $diagonalDown == false) {
|
||||||
|
$docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_NONE);
|
||||||
|
} elseif ($diagonalUp == true && $diagonalDown == false) {
|
||||||
$docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_UP);
|
$docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_UP);
|
||||||
} elseif ($style->border["diagonalDown"] == 'true') {
|
} elseif ($diagonalUp == false && $diagonalDown == true) {
|
||||||
$docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_DOWN);
|
$docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_DOWN);
|
||||||
|
} elseif ($diagonalUp == true && $diagonalDown == true) {
|
||||||
|
$docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_BOTH);
|
||||||
}
|
}
|
||||||
$this->_readBorder($docStyle->getBorders()->getLeft(), $style->border->left);
|
$this->_readBorder($docStyle->getBorders()->getLeft(), $style->border->left);
|
||||||
$this->_readBorder($docStyle->getBorders()->getRight(), $style->border->right);
|
$this->_readBorder($docStyle->getBorders()->getRight(), $style->border->right);
|
||||||
@@ -1418,7 +1487,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
// alignment
|
// alignment
|
||||||
if (isset($style->alignment) && ($style->applyAlignment || $style instanceof SimpleXMLElement)) {
|
if (isset($style->alignment)) {
|
||||||
$docStyle->getAlignment()->setHorizontal((string) $style->alignment["horizontal"]);
|
$docStyle->getAlignment()->setHorizontal((string) $style->alignment["horizontal"]);
|
||||||
$docStyle->getAlignment()->setVertical((string) $style->alignment["vertical"]);
|
$docStyle->getAlignment()->setVertical((string) $style->alignment["vertical"]);
|
||||||
|
|
||||||
@@ -1436,7 +1505,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
// protection
|
// protection
|
||||||
if (isset($style->protection) && $style->applyProtection) {
|
if (isset($style->protection)) {
|
||||||
if (isset($style->protection['locked'])) {
|
if (isset($style->protection['locked'])) {
|
||||||
if ((string)$style->protection['locked'] == 'true') {
|
if ((string)$style->protection['locked'] == 'true') {
|
||||||
$docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_PROTECTED);
|
$docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_PROTECTED);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader_Excel5
|
* @package PHPExcel_Reader_Excel5
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel root directory */
|
/** PHPExcel root directory */
|
||||||
@@ -62,7 +62,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DgContainer/SpgrContainer/S
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader_Excel5
|
* @package PHPExcel_Reader_Excel5
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_Excel5_Escher
|
class PHPExcel_Reader_Excel5_Escher
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
interface PHPExcel_Reader_IReadFilter
|
interface PHPExcel_Reader_IReadFilter
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
interface PHPExcel_Reader_IReader
|
interface PHPExcel_Reader_IReader
|
||||||
{
|
{
|
||||||
|
500
libraries/PHPExcel/PHPExcel/Reader/OOCalc.php
Normal file
500
libraries/PHPExcel/PHPExcel/Reader/OOCalc.php
Normal file
@@ -0,0 +1,500 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader
|
||||||
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version 1.7.2, 2010-01-11
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** PHPExcel root directory */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** PHPExcel */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Reader_IReader */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/IReader.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Worksheet */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Cell */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Calculation */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Reader_DefaultReadFilter */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/DefaultReadFilter.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Reader_OOCalc
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader
|
||||||
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Read data only?
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_readDataOnly = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restict which sheets should be loaded?
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $_loadSheetsOnly = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sheet index to read
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $_sheetIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $_styles = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Reader_IReadFilter instance
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Reader_IReadFilter
|
||||||
|
*/
|
||||||
|
private $_readFilter = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data only?
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getReadDataOnly() {
|
||||||
|
return $this->_readDataOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set read data only
|
||||||
|
*
|
||||||
|
* @param boolean $pValue
|
||||||
|
* @return PHPExcel_Reader_Excel2007
|
||||||
|
*/
|
||||||
|
public function setReadDataOnly($pValue = false) {
|
||||||
|
$this->_readDataOnly = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get which sheets to load
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getLoadSheetsOnly()
|
||||||
|
{
|
||||||
|
return $this->_loadSheetsOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set which sheets to load
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
* @return PHPExcel_Reader_Excel2007
|
||||||
|
*/
|
||||||
|
public function setLoadSheetsOnly($value = null)
|
||||||
|
{
|
||||||
|
$this->_loadSheetsOnly = is_array($value) ?
|
||||||
|
$value : array($value);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set all sheets to load
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Reader_Excel2007
|
||||||
|
*/
|
||||||
|
public function setLoadAllSheets()
|
||||||
|
{
|
||||||
|
$this->_loadSheetsOnly = null;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read filter
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Reader_IReadFilter
|
||||||
|
*/
|
||||||
|
public function getReadFilter() {
|
||||||
|
return $this->_readFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set read filter
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||||
|
* @return PHPExcel_Reader_Excel2007
|
||||||
|
*/
|
||||||
|
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||||
|
$this->_readFilter = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Reader_OOCalc
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->_sheetIndex = 0;
|
||||||
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
|
*
|
||||||
|
* @param string $pFileName
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function canRead($pFilename)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load file
|
||||||
|
$zip = new ZipArchive;
|
||||||
|
if ($zip->open($pFilename) === true) {
|
||||||
|
// check if it is an OOXML archive
|
||||||
|
$mimeType = $zip->getFromName("mimetype");
|
||||||
|
|
||||||
|
$zip->close();
|
||||||
|
|
||||||
|
return ($mimeType === 'application/vnd.oasis.opendocument.spreadsheet');
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads PHPExcel from file
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function load($pFilename)
|
||||||
|
{
|
||||||
|
// Create new PHPExcel
|
||||||
|
$objPHPExcel = new PHPExcel();
|
||||||
|
|
||||||
|
// Load into this instance
|
||||||
|
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) {
|
||||||
|
$styleAttributeValue = strtolower($styleAttributeValue);
|
||||||
|
foreach($styleList as $style) {
|
||||||
|
if ($styleAttributeValue == strtolower($style)) {
|
||||||
|
$styleAttributeValue = $style;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @param PHPExcel $objPHPExcel
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$zip = new ZipArchive;
|
||||||
|
if ($zip->open($pFilename) === true) {
|
||||||
|
// echo '<h1>Meta Information</h1>';
|
||||||
|
$xml = simplexml_load_string($zip->getFromName("meta.xml"));
|
||||||
|
$namespacesMeta = $xml->getNamespaces(true);
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($namespacesMeta);
|
||||||
|
// echo '</pre><hr />';
|
||||||
|
|
||||||
|
$docProps = $objPHPExcel->getProperties();
|
||||||
|
$officeProperty = $xml->children($namespacesMeta['office']);
|
||||||
|
foreach($officeProperty as $officePropertyData) {
|
||||||
|
$officePropertyDC = array();
|
||||||
|
if (isset($namespacesMeta['dc'])) {
|
||||||
|
$officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
|
||||||
|
}
|
||||||
|
foreach($officePropertyDC as $propertyName => $propertyValue) {
|
||||||
|
// echo $propertyName.' = '.$propertyValue.'<hr />';
|
||||||
|
|
||||||
|
switch ($propertyName) {
|
||||||
|
case 'title' :
|
||||||
|
$docProps->setTitle($propertyValue);
|
||||||
|
break;
|
||||||
|
case 'subject' :
|
||||||
|
$docProps->setSubject($propertyValue);
|
||||||
|
break;
|
||||||
|
case 'creator' :
|
||||||
|
$docProps->setCreator($propertyValue);
|
||||||
|
break;
|
||||||
|
case 'date' :
|
||||||
|
$creationDate = strtotime($propertyValue);
|
||||||
|
$docProps->setCreated($creationDate);
|
||||||
|
break;
|
||||||
|
case 'description' :
|
||||||
|
$docProps->setDescription($propertyValue);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$officePropertyMeta = array();
|
||||||
|
if (isset($namespacesMeta['dc'])) {
|
||||||
|
$officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']);
|
||||||
|
}
|
||||||
|
foreach($officePropertyMeta as $propertyName => $propertyValue) {
|
||||||
|
$propertyValueAttributes = $propertyValue->attributes($namespacesMeta['meta']);
|
||||||
|
|
||||||
|
// echo $propertyName.' = '.$propertyValue.'<br />';
|
||||||
|
// foreach ($propertyValueAttributes as $key => $value) {
|
||||||
|
// echo $key.' = '.$value.'<br />';
|
||||||
|
// }
|
||||||
|
// echo '<hr />';
|
||||||
|
//
|
||||||
|
switch ($propertyName) {
|
||||||
|
case 'keyword' :
|
||||||
|
$docProps->setKeywords($propertyValue);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// echo '<h1>Workbook Content</h1>';
|
||||||
|
$xml = simplexml_load_string($zip->getFromName("content.xml"));
|
||||||
|
$namespacesContent = $xml->getNamespaces(true);
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($namespacesContent);
|
||||||
|
// echo '</pre><hr />';
|
||||||
|
|
||||||
|
$workbook = $xml->children($namespacesContent['office']);
|
||||||
|
foreach($workbook->body->spreadsheet as $workbookData) {
|
||||||
|
$workbookData = $workbookData->children($namespacesContent['table']);
|
||||||
|
$worksheetID = 0;
|
||||||
|
foreach($workbookData->table as $worksheetDataSet) {
|
||||||
|
$worksheetData = $worksheetDataSet->children($namespacesContent['table']);
|
||||||
|
// print_r($worksheetData);
|
||||||
|
// echo '<br />';
|
||||||
|
$worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']);
|
||||||
|
// print_r($worksheetDataAttributes);
|
||||||
|
// echo '<br />';
|
||||||
|
if ((isset($this->_loadSheetsOnly)) && (isset($worksheetDataAttributes['name'])) &&
|
||||||
|
(!in_array($worksheetDataAttributes['name'], $this->_loadSheetsOnly))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// echo '<h2>Worksheet '.$worksheetDataAttributes['name'].'</h2>';
|
||||||
|
// Create new Worksheet
|
||||||
|
$objPHPExcel->createSheet();
|
||||||
|
$objPHPExcel->setActiveSheetIndex($worksheetID);
|
||||||
|
if (isset($worksheetDataAttributes['name'])) {
|
||||||
|
$worksheetName = $worksheetDataAttributes['name'];
|
||||||
|
$objPHPExcel->getActiveSheet()->setTitle($worksheetName);
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowID = 1;
|
||||||
|
foreach($worksheetData as $key => $rowData) {
|
||||||
|
// echo '<b>'.$key.'</b><br />';
|
||||||
|
switch ($key) {
|
||||||
|
case 'table-row' :
|
||||||
|
$columnID = 'A';
|
||||||
|
foreach($rowData as $key => $cellData) {
|
||||||
|
// echo '<b>'.$columnID.$rowID.'</b><br />';
|
||||||
|
$cellDataText = $cellData->children($namespacesContent['text']);
|
||||||
|
$cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']);
|
||||||
|
$cellDataTableAttributes = $cellData->attributes($namespacesContent['table']);
|
||||||
|
|
||||||
|
// echo 'Office Attributes: ';
|
||||||
|
// print_r($cellDataOfficeAttributes);
|
||||||
|
// echo '<br />Table Attributes: ';
|
||||||
|
// print_r($cellDataTableAttributes);
|
||||||
|
// echo '<br />Cell Data Text';
|
||||||
|
// print_r($cellDataText);
|
||||||
|
// echo '<br />';
|
||||||
|
//
|
||||||
|
$type = $formatting = $hyperlink = null;
|
||||||
|
$hasCalculatedValue = false;
|
||||||
|
$cellDataFormula = '';
|
||||||
|
if (isset($cellDataTableAttributes['formula'])) {
|
||||||
|
$cellDataFormula = $cellDataTableAttributes['formula'];
|
||||||
|
$hasCalculatedValue = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($cellDataText->p)) {
|
||||||
|
// echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />';
|
||||||
|
switch ($cellDataOfficeAttributes['value-type']) {
|
||||||
|
case 'string' :
|
||||||
|
$type = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||||
|
$dataValue = $cellDataText->p;
|
||||||
|
if (isset($dataValue->a)) {
|
||||||
|
$dataValue = $dataValue->a;
|
||||||
|
$cellXLinkAttributes = $dataValue->attributes($namespacesContent['xlink']);
|
||||||
|
$hyperlink = $cellXLinkAttributes['href'];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'boolean' :
|
||||||
|
$type = PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||||
|
$dataValue = ($cellDataText->p == 'TRUE') ? True : False;
|
||||||
|
break;
|
||||||
|
case 'float' :
|
||||||
|
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||||
|
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||||
|
if (floor($dataValue) == $dataValue) {
|
||||||
|
$dataValue = (integer) $dataValue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'date' :
|
||||||
|
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||||
|
$dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellDataOfficeAttributes['date-value']));
|
||||||
|
if ($dataValue != floor($dataValue)) {
|
||||||
|
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15.' '.PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
|
||||||
|
} else {
|
||||||
|
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'time' :
|
||||||
|
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||||
|
$dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime('01-01-1970 '.implode(':',sscanf($cellDataOfficeAttributes['time-value'],'PT%dH%dM%dS'))));
|
||||||
|
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// echo 'Data value is '.$dataValue.'<br />';
|
||||||
|
// if (!is_null($hyperlink)) {
|
||||||
|
// echo 'Hyperlink is '.$hyperlink.'<br />';
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($hasCalculatedValue) {
|
||||||
|
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||||
|
// echo 'Formula: '.$cellDataFormula.'<br />';
|
||||||
|
$cellDataFormula = substr($cellDataFormula,strpos($cellDataFormula,':=')+1);
|
||||||
|
$temp = explode('"',$cellDataFormula);
|
||||||
|
foreach($temp as $key => &$value) {
|
||||||
|
// Only replace in alternate array entries (i.e. non-quoted blocks)
|
||||||
|
if (($key % 2) == 0) {
|
||||||
|
$value = preg_replace('/\[\.(.*):\.(.*)\]/Ui','$1:$2',$value);
|
||||||
|
$value = preg_replace('/\[\.(.*)\]/Ui','$1',$value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($value);
|
||||||
|
// Then rebuild the formula string
|
||||||
|
$cellDataFormula = implode('"',$temp);
|
||||||
|
// echo 'Adjusted Formula: '.$cellDataFormula.'<br />';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_null($type)) {
|
||||||
|
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue),$type);
|
||||||
|
if ($hasCalculatedValue) {
|
||||||
|
// echo 'Forumla result is '.$dataValue.'<br />';
|
||||||
|
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($dataValue);
|
||||||
|
}
|
||||||
|
if (($cellDataOfficeAttributes['value-type'] == 'date') ||
|
||||||
|
($cellDataOfficeAttributes['value-type'] == 'time')) {
|
||||||
|
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rowID)->getNumberFormat()->setFormatCode($formatting);
|
||||||
|
}
|
||||||
|
if (!is_null($hyperlink)) {
|
||||||
|
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->getHyperlink()->setUrl($hyperlink);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merged cells
|
||||||
|
if ((isset($cellDataTableAttributes['number-columns-spanned'])) || (isset($cellDataTableAttributes['number-rows-spanned']))) {
|
||||||
|
$columnTo = $columnID;
|
||||||
|
if (isset($cellDataTableAttributes['number-columns-spanned'])) {
|
||||||
|
$columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cellDataTableAttributes['number-columns-spanned'] -2);
|
||||||
|
}
|
||||||
|
$rowTo = $rowID;
|
||||||
|
if (isset($cellDataTableAttributes['number-rows-spanned'])) {
|
||||||
|
$rowTo = $rowTo + $cellDataTableAttributes['number-rows-spanned'] - 1;
|
||||||
|
}
|
||||||
|
$cellRange = $columnID.$rowID.':'.$columnTo.$rowTo;
|
||||||
|
$objPHPExcel->getActiveSheet()->mergeCells($cellRange);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($cellDataTableAttributes['number-columns-repeated'])) {
|
||||||
|
// echo 'Repeated '.$cellDataTableAttributes['number-columns-repeated'].' times<br />';
|
||||||
|
$columnID = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cellDataTableAttributes['number-columns-repeated'] - 2);
|
||||||
|
}
|
||||||
|
++$columnID;
|
||||||
|
}
|
||||||
|
++$rowID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
++$worksheetID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return $objPHPExcel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get sheet index
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getSheetIndex() {
|
||||||
|
return $this->_sheetIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set sheet index
|
||||||
|
*
|
||||||
|
* @param int $pValue Sheet index
|
||||||
|
* @return PHPExcel_Reader_OOCalc
|
||||||
|
*/
|
||||||
|
public function setSheetIndex($pValue = 0) {
|
||||||
|
$this->_sheetIndex = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
506
libraries/PHPExcel/PHPExcel/Reader/SYLK.php
Normal file
506
libraries/PHPExcel/PHPExcel/Reader/SYLK.php
Normal file
@@ -0,0 +1,506 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader
|
||||||
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version 1.7.2, 2010-01-11
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** PHPExcel root directory */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** PHPExcel */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Reader_IReader */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/IReader.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Worksheet */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Cell */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Calculation */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Reader_DefaultReadFilter */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/DefaultReadFilter.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Reader_SYLK
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader
|
||||||
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Input encoding
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_inputEncoding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delimiter
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_delimiter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enclosure
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_enclosure;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Line ending
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_lineEnding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sheet index to read
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $_sheetIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $_formats = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format Count
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $_format = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Reader_IReadFilter instance
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Reader_IReadFilter
|
||||||
|
*/
|
||||||
|
private $_readFilter = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Reader_SYLK
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->_inputEncoding = 'ANSI';
|
||||||
|
$this->_delimiter = ';';
|
||||||
|
$this->_enclosure = '"';
|
||||||
|
$this->_lineEnding = PHP_EOL;
|
||||||
|
$this->_sheetIndex = 0;
|
||||||
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
|
*
|
||||||
|
* @param string $pFileName
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function canRead($pFilename)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read sample data (first 2 KB will do)
|
||||||
|
$fh = fopen($pFilename, 'r');
|
||||||
|
$data = fread($fh, 2048);
|
||||||
|
fclose($fh);
|
||||||
|
|
||||||
|
// Count delimiters in file
|
||||||
|
$delimiterCount = substr_count($data, ';');
|
||||||
|
if ($delimiterCount < 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Analyze first line looking for ID; signature
|
||||||
|
$lines = explode("\n", $data);
|
||||||
|
if (substr($lines[0],0,4) != 'ID;P') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads PHPExcel from file
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function load($pFilename)
|
||||||
|
{
|
||||||
|
// Create new PHPExcel
|
||||||
|
$objPHPExcel = new PHPExcel();
|
||||||
|
|
||||||
|
// Load into this instance
|
||||||
|
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read filter
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Reader_IReadFilter
|
||||||
|
*/
|
||||||
|
public function getReadFilter() {
|
||||||
|
return $this->_readFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set read filter
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||||
|
*/
|
||||||
|
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||||
|
$this->_readFilter = $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set input encoding
|
||||||
|
*
|
||||||
|
* @param string $pValue Input encoding
|
||||||
|
*/
|
||||||
|
public function setInputEncoding($pValue = 'ANSI')
|
||||||
|
{
|
||||||
|
$this->_inputEncoding = $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get input encoding
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getInputEncoding()
|
||||||
|
{
|
||||||
|
return $this->_inputEncoding;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @param PHPExcel $objPHPExcel
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new PHPExcel
|
||||||
|
while ($objPHPExcel->getSheetCount() <= $this->_sheetIndex) {
|
||||||
|
$objPHPExcel->createSheet();
|
||||||
|
}
|
||||||
|
$objPHPExcel->setActiveSheetIndex( $this->_sheetIndex );
|
||||||
|
|
||||||
|
$fromFormats = array('\-', '\ ');
|
||||||
|
$toFormats = array('-', ' ');
|
||||||
|
|
||||||
|
// Open file
|
||||||
|
$fileHandle = fopen($pFilename, 'r');
|
||||||
|
if ($fileHandle === false) {
|
||||||
|
throw new Exception("Could not open file $pFilename for reading.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop through file
|
||||||
|
$rowData = array();
|
||||||
|
$column = $row = '';
|
||||||
|
while (($rowData = fgets($fileHandle)) !== FALSE) {
|
||||||
|
$rowData = explode("\t",str_replace('<27>',';',str_replace(';',"\t",str_replace(';;','<27>',rtrim($rowData)))));
|
||||||
|
$dataType = array_shift($rowData);
|
||||||
|
// Read shared styles
|
||||||
|
if ($dataType == 'P') {
|
||||||
|
$formatArray = array();
|
||||||
|
foreach($rowData as $rowDatum) {
|
||||||
|
switch($rowDatum{0}) {
|
||||||
|
case 'P' : $formatArray['numberformat']['code'] = str_replace($fromFormats,$toFormats,substr($rowDatum,1));
|
||||||
|
break;
|
||||||
|
case 'E' :
|
||||||
|
case 'F' : $formatArray['font']['name'] = substr($rowDatum,1);
|
||||||
|
break;
|
||||||
|
case 'L' : $formatArray['font']['size'] = substr($rowDatum,1);
|
||||||
|
break;
|
||||||
|
case 'S' : $styleSettings = substr($rowDatum,1);
|
||||||
|
for ($i=0;$i<strlen($styleSettings);++$i) {
|
||||||
|
switch ($styleSettings{$i}) {
|
||||||
|
case 'I' : $formatArray['font']['italic'] = true;
|
||||||
|
break;
|
||||||
|
case 'D' : $formatArray['font']['bold'] = true;
|
||||||
|
break;
|
||||||
|
case 'T' : $formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
case 'B' : $formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
case 'L' : $formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
case 'R' : $formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->_formats['P'.$this->_format++] = $formatArray;
|
||||||
|
// Read cell value data
|
||||||
|
} elseif ($dataType == 'C') {
|
||||||
|
$hasCalculatedValue = false;
|
||||||
|
$cellData = $cellDataFormula = '';
|
||||||
|
foreach($rowData as $rowDatum) {
|
||||||
|
switch($rowDatum{0}) {
|
||||||
|
case 'C' :
|
||||||
|
case 'X' : $column = substr($rowDatum,1);
|
||||||
|
break;
|
||||||
|
case 'R' :
|
||||||
|
case 'Y' : $row = substr($rowDatum,1);
|
||||||
|
break;
|
||||||
|
case 'K' : $cellData = substr($rowDatum,1);
|
||||||
|
break;
|
||||||
|
case 'E' : $cellDataFormula = '='.substr($rowDatum,1);
|
||||||
|
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
||||||
|
$temp = explode('"',$cellDataFormula);
|
||||||
|
foreach($temp as $key => &$value) {
|
||||||
|
// Only count/replace in alternate array entries
|
||||||
|
if (($key % 2) == 0) {
|
||||||
|
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/',$value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||||
|
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
|
||||||
|
// through the formula from left to right. Reversing means that we work right to left.through
|
||||||
|
// the formula
|
||||||
|
$cellReferences = array_reverse($cellReferences);
|
||||||
|
// Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
|
||||||
|
// then modify the formula to use that new reference
|
||||||
|
foreach($cellReferences as $cellReference) {
|
||||||
|
$rowReference = $cellReference[2][0];
|
||||||
|
// Empty R reference is the current row
|
||||||
|
if ($rowReference == '') $rowReference = $row;
|
||||||
|
// Bracketed R references are relative to the current row
|
||||||
|
if ($rowReference{0} == '[') $rowReference = $row + trim($rowReference,'[]');
|
||||||
|
$columnReference = $cellReference[4][0];
|
||||||
|
// Empty C reference is the current column
|
||||||
|
if ($columnReference == '') $columnReference = $column;
|
||||||
|
// Bracketed C references are relative to the current column
|
||||||
|
if ($columnReference{0} == '[') $columnReference = $column + trim($columnReference,'[]');
|
||||||
|
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
||||||
|
|
||||||
|
$value = substr_replace($value,$A1CellReference,$cellReference[0][1],strlen($cellReference[0][0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($value);
|
||||||
|
// Then rebuild the formula string
|
||||||
|
$cellDataFormula = implode('"',$temp);
|
||||||
|
$hasCalculatedValue = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||||
|
$cellData = PHPExcel_Calculation::_unwrapResult($cellData);
|
||||||
|
// Set cell value
|
||||||
|
$objPHPExcel->getActiveSheet()->setCellValue($columnLetter.$row, (($hasCalculatedValue) ? $cellDataFormula : $cellData));
|
||||||
|
if ($hasCalculatedValue) {
|
||||||
|
$cellData = PHPExcel_Calculation::_unwrapResult($cellData);
|
||||||
|
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData);
|
||||||
|
}
|
||||||
|
// Read cell formatting
|
||||||
|
} elseif ($dataType == 'F') {
|
||||||
|
$formatStyle = $columnWidth = $styleSettings = '';
|
||||||
|
$styleData = array();
|
||||||
|
foreach($rowData as $rowDatum) {
|
||||||
|
switch($rowDatum{0}) {
|
||||||
|
case 'C' :
|
||||||
|
case 'X' : $column = substr($rowDatum,1);
|
||||||
|
break;
|
||||||
|
case 'R' :
|
||||||
|
case 'Y' : $row = substr($rowDatum,1);
|
||||||
|
break;
|
||||||
|
case 'P' : $formatStyle = $rowDatum;
|
||||||
|
break;
|
||||||
|
case 'W' : list($startCol,$endCol,$columnWidth) = explode(' ',substr($rowDatum,1));
|
||||||
|
break;
|
||||||
|
case 'S' : $styleSettings = substr($rowDatum,1);
|
||||||
|
for ($i=0;$i<strlen($styleSettings);++$i) {
|
||||||
|
switch ($styleSettings{$i}) {
|
||||||
|
case 'I' : $styleData['font']['italic'] = true;
|
||||||
|
break;
|
||||||
|
case 'D' : $styleData['font']['bold'] = true;
|
||||||
|
break;
|
||||||
|
case 'T' : $styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
case 'B' : $styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
case 'L' : $styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
case 'R' : $styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (($formatStyle > '') && ($column > '') && ($row > '')) {
|
||||||
|
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||||
|
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->_formats[$formatStyle]);
|
||||||
|
}
|
||||||
|
if ((count($styleData) > 0) && ($column > '') && ($row > '')) {
|
||||||
|
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||||
|
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($styleData);
|
||||||
|
}
|
||||||
|
if ($columnWidth > '') {
|
||||||
|
if ($startCol == $endCol) {
|
||||||
|
$startCol = PHPExcel_Cell::stringFromColumnIndex($startCol-1);
|
||||||
|
$objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth);
|
||||||
|
} else {
|
||||||
|
$startCol = PHPExcel_Cell::stringFromColumnIndex($startCol-1);
|
||||||
|
$endCol = PHPExcel_Cell::stringFromColumnIndex($endCol-1);
|
||||||
|
$objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth);
|
||||||
|
do {
|
||||||
|
$objPHPExcel->getActiveSheet()->getColumnDimension(++$startCol)->setWidth($columnWidth);
|
||||||
|
} while ($startCol != $endCol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
foreach($rowData as $rowDatum) {
|
||||||
|
switch($rowDatum{0}) {
|
||||||
|
case 'C' :
|
||||||
|
case 'X' : $column = substr($rowDatum,1);
|
||||||
|
break;
|
||||||
|
case 'R' :
|
||||||
|
case 'Y' : $row = substr($rowDatum,1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close file
|
||||||
|
fclose($fileHandle);
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return $objPHPExcel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get delimiter
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getDelimiter() {
|
||||||
|
return $this->_delimiter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set delimiter
|
||||||
|
*
|
||||||
|
* @param string $pValue Delimiter, defaults to ,
|
||||||
|
* @return PHPExcel_Reader_SYLK
|
||||||
|
*/
|
||||||
|
public function setDelimiter($pValue = ',') {
|
||||||
|
$this->_delimiter = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get enclosure
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getEnclosure() {
|
||||||
|
return $this->_enclosure;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set enclosure
|
||||||
|
*
|
||||||
|
* @param string $pValue Enclosure, defaults to "
|
||||||
|
* @return PHPExcel_Reader_SYLK
|
||||||
|
*/
|
||||||
|
public function setEnclosure($pValue = '"') {
|
||||||
|
if ($pValue == '') {
|
||||||
|
$pValue = '"';
|
||||||
|
}
|
||||||
|
$this->_enclosure = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get line ending
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLineEnding() {
|
||||||
|
return $this->_lineEnding;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set line ending
|
||||||
|
*
|
||||||
|
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
|
||||||
|
* @return PHPExcel_Reader_SYLK
|
||||||
|
*/
|
||||||
|
public function setLineEnding($pValue = PHP_EOL) {
|
||||||
|
$this->_lineEnding = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get sheet index
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getSheetIndex() {
|
||||||
|
return $this->_sheetIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set sheet index
|
||||||
|
*
|
||||||
|
* @param int $pValue Sheet index
|
||||||
|
* @return PHPExcel_Reader_SYLK
|
||||||
|
*/
|
||||||
|
public function setSheetIndex($pValue = 0) {
|
||||||
|
$this->_sheetIndex = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/File.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Reader
|
* @package PHPExcel_Reader
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_Serialized implements PHPExcel_Reader_IReader
|
class PHPExcel_Reader_Serialized implements PHPExcel_Reader_IReader
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation/FormulaToken.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_ReferenceHelper
|
class PHPExcel_ReferenceHelper
|
||||||
{
|
{
|
||||||
@@ -86,7 +86,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Calculation
|
* Create a new PHPExcel_ReferenceHelper
|
||||||
*/
|
*/
|
||||||
protected function __construct() {
|
protected function __construct() {
|
||||||
}
|
}
|
||||||
@@ -303,14 +303,13 @@ class PHPExcel_ReferenceHelper
|
|||||||
|
|
||||||
|
|
||||||
// Update worksheet: merge cells
|
// Update worksheet: merge cells
|
||||||
$aMergeCells = array_reverse($pSheet->getMergeCells(), true);
|
$aMergeCells = $pSheet->getMergeCells();
|
||||||
foreach ($aMergeCells as $key => $value) {
|
$aNewMergeCells = array(); // the new array of all merge cells
|
||||||
|
foreach ($aMergeCells as $key => &$value) {
|
||||||
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
|
||||||
if ($key != $newReference) {
|
$aNewMergeCells[$newReference] = $newReference;
|
||||||
$pSheet->mergeCells( $newReference );
|
|
||||||
$pSheet->unmergeCells( $key );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
$pSheet->setMergeCells($aNewMergeCells); // replace the merge cells array
|
||||||
|
|
||||||
|
|
||||||
// Update worksheet: protected cells
|
// Update worksheet: protected cells
|
||||||
@@ -378,29 +377,46 @@ class PHPExcel_ReferenceHelper
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
|
||||||
// Formula stack
|
|
||||||
$executableFormulaArray = array();
|
|
||||||
|
|
||||||
// Parse formula into a tree of tokens
|
// Parse formula into a tree of tokens
|
||||||
$tokenisedFormula = PHPExcel_Calculation::getInstance()->parseFormula($pFormula);
|
$tokenisedFormula = PHPExcel_Calculation::getInstance()->parseFormula($pFormula);
|
||||||
|
|
||||||
$newCellTokens = $cellTokens = array();
|
$newCellTokens = $cellTokens = array();
|
||||||
|
$adjustCount = 0;
|
||||||
// Build the translation table of cell tokens
|
// Build the translation table of cell tokens
|
||||||
foreach($tokenisedFormula as $token) {
|
foreach($tokenisedFormula as $token) {
|
||||||
|
$token = $token['value'];
|
||||||
if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) {
|
if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $token, $matches)) {
|
||||||
$newCellTokens[] = $this->updateCellReference($token, $pBefore, $pNumCols, $pNumRows);
|
list($column,$row) = PHPExcel_Cell::coordinateFromString($token);
|
||||||
$cellTokens[] = '/'.$token.'/';
|
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
|
||||||
|
$column = PHPExcel_Cell::columnIndexFromString($column) + 100000;
|
||||||
|
$row += 10000000;
|
||||||
|
$cellIndex = $column.$row;
|
||||||
|
if (!isset($cellTokens[$cellIndex])) {
|
||||||
|
$newReference = $this->updateCellReference($token, $pBefore, $pNumCols, $pNumRows);
|
||||||
|
if ($newReference !== $token) {
|
||||||
|
$newCellTokens[$cellIndex] = preg_quote($newReference);
|
||||||
|
$cellTokens[$cellIndex] = '/(?<![A-Z])'.preg_quote($token).'(?!\d)/i';
|
||||||
|
++$adjustCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($adjustCount == 0) {
|
||||||
|
return $pFormula;
|
||||||
|
}
|
||||||
|
krsort($cellTokens);
|
||||||
|
krsort($newCellTokens);
|
||||||
|
|
||||||
// Update cell references in the formula
|
// Update cell references in the formula
|
||||||
$formulaBlocks = explode('"',$pFormula);
|
$formulaBlocks = explode('"',$pFormula);
|
||||||
$i = 0;
|
foreach($formulaBlocks as $i => &$formulaBlock) {
|
||||||
foreach($formulaBlocks as $formulaBlockKey => $formulaBlock) {
|
|
||||||
// Only count/replace in alternate array entries
|
// Only count/replace in alternate array entries
|
||||||
if (($i++ % 2) == 0) {
|
if (($i % 2) == 0) {
|
||||||
$formulaBlocks[$formulaBlockKey] = preg_replace($cellTokens,$newCellTokens,$formulaBlock);
|
$formulaBlock = preg_replace($cellTokens,$newCellTokens,$formulaBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unset($formulaBlock);
|
||||||
|
|
||||||
// Then rebuild the formula string
|
// Then rebuild the formula string
|
||||||
return implode('"',$formulaBlocks);
|
return implode('"',$formulaBlocks);
|
||||||
}
|
}
|
||||||
@@ -423,7 +439,7 @@ class PHPExcel_ReferenceHelper
|
|||||||
} elseif (strpos($pCellRange, ':') === false && strpos($pCellRange, ',') === false) {
|
} elseif (strpos($pCellRange, ':') === false && strpos($pCellRange, ',') === false) {
|
||||||
// Single cell
|
// Single cell
|
||||||
return $this->_updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows);
|
return $this->_updateSingleCellReference($pCellRange, $pBefore, $pNumCols, $pNumRows);
|
||||||
} else if (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) {
|
} elseif (strpos($pCellRange, ':') !== false || strpos($pCellRange, ',') !== false) {
|
||||||
// Range
|
// Range
|
||||||
return $this->_updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows);
|
return $this->_updateCellRange($pCellRange, $pBefore, $pNumCols, $pNumRows);
|
||||||
} else {
|
} else {
|
||||||
@@ -440,6 +456,10 @@ class PHPExcel_ReferenceHelper
|
|||||||
* @param string $newName New name
|
* @param string $newName New name
|
||||||
*/
|
*/
|
||||||
public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '') {
|
public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '') {
|
||||||
|
if ($oldName == '') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($pPhpExcel->getWorksheetIterator() as $sheet) {
|
foreach ($pPhpExcel->getWorksheetIterator() as $sheet) {
|
||||||
foreach ($sheet->getCellCollection(false) as $cell) {
|
foreach ($sheet->getCellCollection(false) as $cell) {
|
||||||
if (!is_null($cell) && $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
if (!is_null($cell) && $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
|
||||||
@@ -468,8 +488,8 @@ class PHPExcel_ReferenceHelper
|
|||||||
if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) {
|
if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) {
|
||||||
// Update range
|
// Update range
|
||||||
$range = PHPExcel_Cell::splitRange($pCellRange);
|
$range = PHPExcel_Cell::splitRange($pCellRange);
|
||||||
for ($i = 0; $i < count($range); $i++) {
|
for ($i = 0; $i < count($range); ++$i) {
|
||||||
for ($j = 0; $j < count($range[$i]); $j++) {
|
for ($j = 0; $j < count($range[$i]); ++$j) {
|
||||||
$range[$i][$j] = $this->_updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows);
|
$range[$i][$j] = $this->_updateSingleCellReference($range[$i][$j], $pBefore, $pNumCols, $pNumRows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Font.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_RichText implements PHPExcel_IComparable
|
class PHPExcel_RichText implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -157,7 +157,7 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||||||
// Return value
|
// Return value
|
||||||
$returnValue = '';
|
$returnValue = '';
|
||||||
|
|
||||||
// Loop trough all PHPExcel_RichText_ITextElement
|
// Loop through all PHPExcel_RichText_ITextElement
|
||||||
foreach ($this->_richTextElements as $text) {
|
foreach ($this->_richTextElements as $text) {
|
||||||
$returnValue .= $text->getText();
|
$returnValue .= $text->getText();
|
||||||
}
|
}
|
||||||
@@ -257,37 +257,6 @@ class PHPExcel_RichText implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -18,9 +18,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Font.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
interface PHPExcel_RichText_ITextElement
|
interface PHPExcel_RichText_ITextElement
|
||||||
{
|
{
|
||||||
|
@@ -18,9 +18,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Font.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
|
class PHPExcel_RichText_Run extends PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
|
||||||
{
|
{
|
||||||
|
@@ -18,9 +18,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Font.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_RichText
|
* @package PHPExcel_RichText
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
|
class PHPExcel_RichText_TextElement implements PHPExcel_RichText_ITextElement
|
||||||
{
|
{
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -21,9 +21,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Style/NumberFormat.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Date
|
class PHPExcel_Shared_Date
|
||||||
{
|
{
|
||||||
@@ -106,12 +106,15 @@ class PHPExcel_Shared_Date
|
|||||||
// Perform conversion
|
// Perform conversion
|
||||||
if ($dateValue >= 1) {
|
if ($dateValue >= 1) {
|
||||||
$utcDays = $dateValue - $myExcelBaseDate;
|
$utcDays = $dateValue - $myExcelBaseDate;
|
||||||
$returnValue = (integer) round($utcDays * 24 * 60 * 60);
|
$returnValue = round($utcDays * 24 * 60 * 60);
|
||||||
|
if (($returnValue <= PHP_INT_MAX) && ($returnValue >= -PHP_INT_MAX)) {
|
||||||
|
$returnValue = (integer) $returnValue;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$hours = round($dateValue * 24);
|
$hours = round($dateValue * 24);
|
||||||
$mins = round($dateValue * 24 * 60) - round($hours * 60);
|
$mins = round($dateValue * 24 * 60) - round($hours * 60);
|
||||||
$secs = round($dateValue * 24 * 60 * 60) - round($hours * 60 * 60) - round($mins * 60);
|
$secs = round($dateValue * 24 * 60 * 60) - round($hours * 60 * 60) - round($mins * 60);
|
||||||
$returnValue = (integer) mktime($hours, $mins, $secs);
|
$returnValue = (integer) gmmktime($hours, $mins, $secs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
@@ -132,8 +135,10 @@ class PHPExcel_Shared_Date
|
|||||||
$hours = round($time / 3600);
|
$hours = round($time / 3600);
|
||||||
$minutes = round($time / 60) - ($hours * 60);
|
$minutes = round($time / 60) - ($hours * 60);
|
||||||
$seconds = round($time) - ($hours * 3600) - ($minutes * 60);
|
$seconds = round($time) - ($hours * 3600) - ($minutes * 60);
|
||||||
|
|
||||||
$dateObj = date_create('1-Jan-1970+'.$days.' days');
|
$dateObj = date_create('1-Jan-1970+'.$days.' days');
|
||||||
$dateObj->setTime($hours,$minutes,$seconds);
|
$dateObj->setTime($hours,$minutes,$seconds);
|
||||||
|
|
||||||
return $dateObj;
|
return $dateObj;
|
||||||
} // function ExcelToPHPObject()
|
} // function ExcelToPHPObject()
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,18 +20,30 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** PHPExcel root */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** PHPExcel_Shared_String */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Font.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Shared_Drawing
|
* PHPExcel_Shared_Drawing
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Drawing
|
class PHPExcel_Shared_Drawing
|
||||||
{
|
{
|
||||||
@@ -60,31 +72,65 @@ class PHPExcel_Shared_Drawing
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert pixels to cell dimension. Exact algorithm not known.
|
* Convert pixels to column width. Exact algorithm not known.
|
||||||
* By inspection of a real Excel file using Calibri 11, one finds 1000px ~ 142.85546875
|
* By inspection of a real Excel file using Calibri 11, one finds 1000px ~ 142.85546875
|
||||||
* This gives a conversion factor of 7. Also, we assume that pixels and font size are proportional.
|
* This gives a conversion factor of 7. Also, we assume that pixels and font size are proportional.
|
||||||
*
|
*
|
||||||
* @param int $pValue Value in pixels
|
* @param int $pValue Value in pixels
|
||||||
* @param int $pFontSize Default font size of workbook
|
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
|
||||||
* @return int Value in cell dimension
|
* @return int Value in cell dimension
|
||||||
*/
|
*/
|
||||||
public static function pixelsToCellDimension($pValue = 0, $pFontSize = 11) {
|
public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont) {
|
||||||
return $pValue * $pFontSize / 11 / 7;
|
// Font name and size
|
||||||
|
$name = $pDefaultFont->getName();
|
||||||
|
$size = $pDefaultFont->getSize();
|
||||||
|
|
||||||
|
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
|
||||||
|
// Exact width can be determined
|
||||||
|
$colWidth = $pValue
|
||||||
|
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width']
|
||||||
|
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'];
|
||||||
|
} else {
|
||||||
|
// We don't have data for this particular font and size, use approximation by
|
||||||
|
// extrapolating from Calibri 11
|
||||||
|
$colWidth = $pValue * 11
|
||||||
|
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width']
|
||||||
|
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $colWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert cell width to pixels
|
* Convert column width from (intrinsic) Excel units to pixels
|
||||||
*
|
*
|
||||||
* @param int $pValue Value in cell dimension
|
* @param float $pValue Value in cell dimension
|
||||||
* @param int $pFontSize Default font size of workbook
|
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
|
||||||
* @return int Value in pixels
|
* @return int Value in pixels
|
||||||
*/
|
*/
|
||||||
public static function cellDimensionToPixels($pValue = 0, $pFontSize = 11) {
|
public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont) {
|
||||||
if ($pValue != 0) {
|
// Font name and size
|
||||||
return $pValue * 7 * $pFontSize / 11;
|
$name = $pDefaultFont->getName();
|
||||||
|
$size = $pDefaultFont->getSize();
|
||||||
|
|
||||||
|
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
|
||||||
|
// Exact width can be determined
|
||||||
|
$colWidth = $pValue
|
||||||
|
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px']
|
||||||
|
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
// We don't have data for this particular font and size, use approximation by
|
||||||
|
// extrapolating from Calibri 11
|
||||||
|
$colWidth = $pValue * $size
|
||||||
|
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px']
|
||||||
|
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Round pixels to closest integer
|
||||||
|
$colWidth = (int) round($colWidth);
|
||||||
|
|
||||||
|
return $colWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher
|
class PHPExcel_Shared_Escher
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DgContainer
|
class PHPExcel_Shared_Escher_DgContainer
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
|
class PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DggContainer
|
class PHPExcel_Shared_Escher_DggContainer
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
|
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Escher
|
* @package PHPExcel_Shared_Escher
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
class PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel root directory */
|
/** PHPExcel root directory */
|
||||||
@@ -39,12 +39,15 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php';
|
|||||||
/** PHPExcel_Shared_Drawing */
|
/** PHPExcel_Shared_Drawing */
|
||||||
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Drawing.php';
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Drawing.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Shared_Font */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Font.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Shared_Excel5
|
* PHPExcel_Shared_Excel5
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Excel5
|
class PHPExcel_Shared_Excel5
|
||||||
{
|
{
|
||||||
@@ -59,8 +62,8 @@ class PHPExcel_Shared_Excel5
|
|||||||
*/
|
*/
|
||||||
public static function sizeCol($sheet, $col = 'A')
|
public static function sizeCol($sheet, $col = 'A')
|
||||||
{
|
{
|
||||||
// default font size of workbook
|
// default font of the workbook
|
||||||
$fontSize = $sheet->getParent()->getDefaultStyle()->getFont()->getSize();
|
$font = $sheet->getParent()->getDefaultStyle()->getFont();
|
||||||
|
|
||||||
$columnDimensions = $sheet->getColumnDimensions();
|
$columnDimensions = $sheet->getColumnDimensions();
|
||||||
|
|
||||||
@@ -70,17 +73,19 @@ class PHPExcel_Shared_Excel5
|
|||||||
// then we have column dimension with explicit width
|
// then we have column dimension with explicit width
|
||||||
$columnDimension = $columnDimensions[$col];
|
$columnDimension = $columnDimensions[$col];
|
||||||
$width = $columnDimension->getWidth();
|
$width = $columnDimension->getWidth();
|
||||||
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $fontSize);
|
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
|
||||||
|
|
||||||
} else if ($sheet->getDefaultColumnDimension()->getWidth() != -1) {
|
} else if ($sheet->getDefaultColumnDimension()->getWidth() != -1) {
|
||||||
|
|
||||||
// then we have default column dimension with explicit width
|
// then we have default column dimension with explicit width
|
||||||
$defaultColumnDimension = $sheet->getDefaultColumnDimension();
|
$defaultColumnDimension = $sheet->getDefaultColumnDimension();
|
||||||
$width = $defaultColumnDimension->getWidth();
|
$width = $defaultColumnDimension->getWidth();
|
||||||
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $fontSize);
|
$pixelWidth = PHPExcel_Shared_Drawing::cellDimensionToPixels($width, $font);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$pixelWidth = (int) 64 * $fontSize / 11; // here we interpolate from Calibri 11
|
|
||||||
|
// we don't even have any default column dimension. Width depends on default font
|
||||||
|
$pixelWidth = PHPExcel_Shared_Font::getDefaultColumnWidthByFont($font, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now find the effective column width in pixels
|
// now find the effective column width in pixels
|
||||||
@@ -104,6 +109,9 @@ class PHPExcel_Shared_Excel5
|
|||||||
*/
|
*/
|
||||||
public static function sizeRow($sheet, $row = 1)
|
public static function sizeRow($sheet, $row = 1)
|
||||||
{
|
{
|
||||||
|
// default font of the workbook
|
||||||
|
$font = $sheet->getParent()->getDefaultStyle()->getFont();
|
||||||
|
|
||||||
$rowDimensions = $sheet->getRowDimensions();
|
$rowDimensions = $sheet->getRowDimensions();
|
||||||
|
|
||||||
// first find the true row height in pixels (uncollapsed and unhidden)
|
// first find the true row height in pixels (uncollapsed and unhidden)
|
||||||
@@ -122,7 +130,11 @@ class PHPExcel_Shared_Excel5
|
|||||||
$pixelRowHeight = PHPExcel_Shared_Drawing::pointsToPixels($rowHeight);
|
$pixelRowHeight = PHPExcel_Shared_Drawing::pointsToPixels($rowHeight);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$pixelRowHeight = 20; // here we assume Calibri 11
|
|
||||||
|
// we don't even have any default row dimension. Height depends on default font
|
||||||
|
$pointRowHeight = PHPExcel_Shared_Font::getDefaultRowHeightByFont($font);
|
||||||
|
$pixelRowHeight = PHPExcel_Shared_Font::fontSizeToPixels($pointRowHeight);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// now find the effective row height in pixels
|
// now find the effective row height in pixels
|
||||||
@@ -301,8 +313,8 @@ class PHPExcel_Shared_Excel5
|
|||||||
// Convert the pixel values to the percentage value expected by Excel
|
// Convert the pixel values to the percentage value expected by Excel
|
||||||
$x1 = $x1 / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024;
|
$x1 = $x1 / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_start)) * 1024;
|
||||||
$y1 = $y1 / self::sizeRow($sheet, $row_start + 1) * 256;
|
$y1 = $y1 / self::sizeRow($sheet, $row_start + 1) * 256;
|
||||||
$x2 = $width / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object
|
$x2 = ($width + 1) / self::sizeCol($sheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object
|
||||||
$y2 = $height / self::sizeRow($sheet, $row_end + 1) * 256; // Distance to bottom of object
|
$y2 = ($height + 1) / self::sizeRow($sheet, $row_end + 1) * 256; // Distance to bottom of object
|
||||||
|
|
||||||
$startCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_start) . ($row_start + 1);
|
$startCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_start) . ($row_start + 1);
|
||||||
$endCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_end) . ($row_end + 1);
|
$endCoordinates = PHPExcel_Cell::stringFromColumnIndex($col_end) . ($row_end + 1);
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_File
|
class PHPExcel_Shared_File
|
||||||
{
|
{
|
||||||
@@ -79,7 +79,7 @@ class PHPExcel_Shared_File
|
|||||||
|
|
||||||
// Found something?
|
// Found something?
|
||||||
if ($returnValue == '' || is_null($returnValue)) {
|
if ($returnValue == '' || is_null($returnValue)) {
|
||||||
$pathArray = split('/' , $pFilename);
|
$pathArray = explode('/' , $pFilename);
|
||||||
while(in_array('..', $pathArray) && $pathArray[0] != '..') {
|
while(in_array('..', $pathArray) && $pathArray[0] != '..') {
|
||||||
for ($i = 0; $i < count($pathArray); ++$i) {
|
for ($i = 0; $i < count($pathArray); ++$i) {
|
||||||
if ($pathArray[$i] == '..' && $i > 0) {
|
if ($pathArray[$i] == '..' && $i > 0) {
|
||||||
@@ -95,4 +95,42 @@ class PHPExcel_Shared_File
|
|||||||
// Return
|
// Return
|
||||||
return $returnValue;
|
return $returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the systems temporary directory.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function sys_get_temp_dir()
|
||||||
|
{
|
||||||
|
// sys_get_temp_dir is only available since PHP 5.2.1
|
||||||
|
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
|
||||||
|
|
||||||
|
if ( !function_exists('sys_get_temp_dir')) {
|
||||||
|
if( $temp = getenv('TMP') ) {
|
||||||
|
return realpath($temp);
|
||||||
|
}
|
||||||
|
if( $temp = getenv('TEMP') ) {
|
||||||
|
return realpath($temp);
|
||||||
|
}
|
||||||
|
if( $temp = getenv('TMPDIR') ) {
|
||||||
|
return realpath($temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// trick for creating a file in system's temporary dir
|
||||||
|
// without knowing the path of the system's temporary dir
|
||||||
|
$temp = tempnam(__FILE__, '');
|
||||||
|
if (file_exists($temp)) {
|
||||||
|
unlink($temp);
|
||||||
|
return realpath(dirname($temp));
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// use ordinary built-in PHP function
|
||||||
|
return realpath(sys_get_temp_dir());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,21 +20,37 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/** PHPExcel root */
|
||||||
|
if (!defined('PHPEXCEL_ROOT')) {
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** PHPExcel_Shared_String */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Shared_Font
|
* PHPExcel_Shared_Font
|
||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_Font
|
class PHPExcel_Shared_Font
|
||||||
{
|
{
|
||||||
|
/* Methods for resolving autosize value */
|
||||||
|
const AUTOSIZE_METHOD_APPROX = 'approx';
|
||||||
|
const AUTOSIZE_METHOD_EXACT = 'exact';
|
||||||
|
|
||||||
/** Character set codes used by BIFF5-8 in Font records */
|
/** Character set codes used by BIFF5-8 in Font records */
|
||||||
const CHARSET_ANSI_LATIN = 0x00;
|
const CHARSET_ANSI_LATIN = 0x00;
|
||||||
const CHARSET_SYSTEM_DEFAULT = 0x01;
|
const CHARSET_SYSTEM_DEFAULT = 0x01;
|
||||||
@@ -56,6 +72,175 @@ class PHPExcel_Shared_Font
|
|||||||
const CHARSET_ANSI_LATIN_II = 0xEE;
|
const CHARSET_ANSI_LATIN_II = 0xEE;
|
||||||
const CHARSET_OEM_LATIN_I = 0xFF;
|
const CHARSET_OEM_LATIN_I = 0xFF;
|
||||||
|
|
||||||
|
// XXX: Constants created!
|
||||||
|
/** Font filenames */
|
||||||
|
const ARIAL = 'arial.ttf';
|
||||||
|
const ARIAL_BOLD = 'arialbd.ttf';
|
||||||
|
const ARIAL_ITALIC = 'ariali.ttf';
|
||||||
|
const ARIAL_BOLD_ITALIC = 'arialbi.ttf';
|
||||||
|
|
||||||
|
const CALIBRI = 'CALIBRI.TTF';
|
||||||
|
const CALIBRI_BOLD = 'CALIBRIB.TTF';
|
||||||
|
const CALIBRI_ITALIC = 'CALIBRII.TTF';
|
||||||
|
const CALIBRI_BOLD_ITALIC = 'CALIBRIZ.TTF';
|
||||||
|
|
||||||
|
const COMIC_SANS_MS = 'comic.ttf';
|
||||||
|
const COMIC_SANS_MS_BOLD = 'comicbd.ttf';
|
||||||
|
|
||||||
|
const COURIER_NEW = 'cour.ttf';
|
||||||
|
const COURIER_NEW_BOLD = 'courbd.ttf';
|
||||||
|
const COURIER_NEW_ITALIC = 'couri.ttf';
|
||||||
|
const COURIER_NEW_BOLD_ITALIC = 'courbi.ttf';
|
||||||
|
|
||||||
|
const GEORGIA = 'georgia.ttf';
|
||||||
|
const GEORGIA_BOLD = 'georgiab.ttf';
|
||||||
|
const GEORGIA_ITALIC = 'georgiai.ttf';
|
||||||
|
const GEORGIA_BOLD_ITALIC = 'georgiaz.ttf';
|
||||||
|
|
||||||
|
const IMPACT = 'impact.ttf';
|
||||||
|
|
||||||
|
const LIBERATION_SANS = 'LiberationSans-Regular.ttf';
|
||||||
|
const LIBERATION_SANS_BOLD = 'LiberationSans-Bold.ttf';
|
||||||
|
const LIBERATION_SANS_ITALIC = 'LiberationSans-Italic.ttf';
|
||||||
|
const LIBERATION_SANS_BOLD_ITALIC = 'LiberationSans-BoldItalic.ttf';
|
||||||
|
|
||||||
|
const LUCIDA_CONSOLE = 'lucon.ttf';
|
||||||
|
const LUCIDA_SANS_UNICODE = 'l_10646.ttf';
|
||||||
|
|
||||||
|
const MICROSOFT_SANS_SERIF = 'micross.ttf';
|
||||||
|
|
||||||
|
const PALATINO_LINOTYPE = 'pala.ttf';
|
||||||
|
const PALATINO_LINOTYPE_BOLD = 'palab.ttf';
|
||||||
|
const PALATINO_LINOTYPE_ITALIC = 'palai.ttf';
|
||||||
|
const PALATINO_LINOTYPE_BOLD_ITALIC = 'palabi.ttf';
|
||||||
|
|
||||||
|
const SYMBOL = 'symbol.ttf';
|
||||||
|
|
||||||
|
const TAHOMA = 'tahoma.ttf';
|
||||||
|
const TAHOMA_BOLD = 'tahomabd.ttf';
|
||||||
|
|
||||||
|
const TIMES_NEW_ROMAN = 'times.ttf';
|
||||||
|
const TIMES_NEW_ROMAN_BOLD = 'timesbd.ttf';
|
||||||
|
const TIMES_NEW_ROMAN_ITALIC = 'timesi.ttf';
|
||||||
|
const TIMES_NEW_ROMAN_BOLD_ITALIC = 'timesbi.ttf';
|
||||||
|
|
||||||
|
const TREBUCHET_MS = 'trebuc.ttf';
|
||||||
|
const TREBUCHET_MS_BOLD = 'trebucbd.ttf';
|
||||||
|
const TREBUCHET_MS_ITALIC = 'trebucit.ttf';
|
||||||
|
const TREBUCHET_MS_BOLD_ITALIC = 'trebucbi.ttf';
|
||||||
|
|
||||||
|
const VERDANA = 'verdana.ttf';
|
||||||
|
const VERDANA_BOLD = 'verdanab.ttf';
|
||||||
|
const VERDANA_ITALIC = 'verdanai.ttf';
|
||||||
|
const VERDANA_BOLD_ITALIC = 'verdanaz.ttf';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AutoSize method
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private static $autoSizeMethod = self::AUTOSIZE_METHOD_APPROX;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path to folder containing TrueType font .ttf files
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private static $trueTypeFontPath = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How wide is a default column for a given default font and size?
|
||||||
|
* Empirical data found by inspecting real Excel files and reading off the pixel width
|
||||||
|
* in Microsoft Office Excel 2007.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $defaultColumnWidths = array(
|
||||||
|
'Arial' => array(
|
||||||
|
1 => array('px' => 24, 'width' => 12.00000000),
|
||||||
|
2 => array('px' => 24, 'width' => 12.00000000),
|
||||||
|
3 => array('px' => 32, 'width' => 10.66406250),
|
||||||
|
4 => array('px' => 32, 'width' => 10.66406250),
|
||||||
|
5 => array('px' => 40, 'width' => 10.00000000),
|
||||||
|
6 => array('px' => 48, 'width' => 9.59765625),
|
||||||
|
7 => array('px' => 48, 'width' => 9.59765625),
|
||||||
|
8 => array('px' => 56, 'width' => 9.33203125),
|
||||||
|
9 => array('px' => 64, 'width' => 9.14062500),
|
||||||
|
10 => array('px' => 64, 'width' => 9.14062500),
|
||||||
|
),
|
||||||
|
'Calibri' => array(
|
||||||
|
1 => array('px' => 24, 'width' => 12.00000000),
|
||||||
|
2 => array('px' => 24, 'width' => 12.00000000),
|
||||||
|
3 => array('px' => 32, 'width' => 10.66406250),
|
||||||
|
4 => array('px' => 32, 'width' => 10.66406250),
|
||||||
|
5 => array('px' => 40, 'width' => 10.00000000),
|
||||||
|
6 => array('px' => 48, 'width' => 9.59765625),
|
||||||
|
7 => array('px' => 48, 'width' => 9.59765625),
|
||||||
|
8 => array('px' => 56, 'width' => 9.33203125),
|
||||||
|
9 => array('px' => 56, 'width' => 9.33203125),
|
||||||
|
10 => array('px' => 64, 'width' => 9.14062500),
|
||||||
|
11 => array('px' => 64, 'width' => 9.14062500),
|
||||||
|
),
|
||||||
|
'Verdana' => array(
|
||||||
|
1 => array('px' => 24, 'width' => 12.00000000),
|
||||||
|
2 => array('px' => 24, 'width' => 12.00000000),
|
||||||
|
3 => array('px' => 32, 'width' => 10.66406250),
|
||||||
|
4 => array('px' => 32, 'width' => 10.66406250),
|
||||||
|
5 => array('px' => 40, 'width' => 10.00000000),
|
||||||
|
6 => array('px' => 48, 'width' => 9.59765625),
|
||||||
|
7 => array('px' => 48, 'width' => 9.59765625),
|
||||||
|
8 => array('px' => 64, 'width' => 9.14062500),
|
||||||
|
9 => array('px' => 72, 'width' => 9.00000000),
|
||||||
|
10 => array('px' => 72, 'width' => 9.00000000),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set autoSize method
|
||||||
|
*
|
||||||
|
* @param string $pValue
|
||||||
|
*/
|
||||||
|
public static function setAutoSizeMethod($pValue = 'approx')
|
||||||
|
{
|
||||||
|
self::$autoSizeMethod = $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get autoSize method
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getAutoSizeMethod()
|
||||||
|
{
|
||||||
|
return self::$autoSizeMethod;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the path to the folder containing .ttf files. There should be a trailing slash.
|
||||||
|
* Typical locations on variout some platforms:
|
||||||
|
* <ul>
|
||||||
|
* <li>C:/Windows/Fonts/</li>
|
||||||
|
* <li>/usr/share/fonts/truetype/</li>
|
||||||
|
* <li>~/.fonts/</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @param string $pValue
|
||||||
|
*/
|
||||||
|
public static function setTrueTypeFontPath($pValue = '')
|
||||||
|
{
|
||||||
|
self::$trueTypeFontPath = $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the path to the folder containing .ttf files.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getTrueTypeFontPath()
|
||||||
|
{
|
||||||
|
return self::$trueTypeFontPath;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate an (approximate) OpenXML column width, based on font size and text contained
|
* Calculate an (approximate) OpenXML column width, based on font size and text contained
|
||||||
*
|
*
|
||||||
@@ -65,29 +250,120 @@ class PHPExcel_Shared_Font
|
|||||||
* @param int $rotation Rotation angle
|
* @param int $rotation Rotation angle
|
||||||
* @return int Column width
|
* @return int Column width
|
||||||
*/
|
*/
|
||||||
public static function calculateColumnWidth($fontSize = 9, $fontSizeInPixels = false, $columnText = '', $rotation = 0) {
|
public static function calculateColumnWidth(PHPExcel_Style_Font $font, $columnText = '', $rotation = 0, PHPExcel_Style_Font $defaultFont = null) {
|
||||||
if (!$fontSizeInPixels) {
|
|
||||||
// Translate points size to pixel size
|
|
||||||
$fontSize = PHPExcel_Shared_Font::fontSizeToPixels($fontSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If it is rich text, use rich text...
|
// If it is rich text, use plain text
|
||||||
if ($columnText instanceof PHPExcel_RichText) {
|
if ($columnText instanceof PHPExcel_RichText) {
|
||||||
$columnText = $columnText->getPlainText();
|
$columnText = $columnText->getPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only measure the part before the first newline character
|
// Only measure the part before the first newline character (is always "\n")
|
||||||
if (strpos($columnText, "\r") !== false) {
|
|
||||||
$columnText = substr($columnText, 0, strpos($columnText, "\r"));
|
|
||||||
}
|
|
||||||
if (strpos($columnText, "\n") !== false) {
|
if (strpos($columnText, "\n") !== false) {
|
||||||
$columnText = substr($columnText, 0, strpos($columnText, "\n"));
|
$columnText = substr($columnText, 0, strpos($columnText, "\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate column width
|
// Try to get the exact text width in pixels
|
||||||
// values 1.025 and 0.584 found via interpolation by inspecting real Excel files with
|
try {
|
||||||
// Calibri font. May need further adjustment
|
// If autosize method is set to 'approx', use approximation
|
||||||
$columnWidth = 1.025 * strlen($columnText) + 0.584; // Excel adds some padding
|
if (self::$autoSizeMethod == self::AUTOSIZE_METHOD_APPROX) {
|
||||||
|
throw new Exception('AutoSize method is set to approx');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Width of text in pixels excl. padding
|
||||||
|
$columnWidth = self::getTextWidthPixelsExact($columnText, $font, $rotation);
|
||||||
|
|
||||||
|
// Excel adds some padding, use 1.07 of the width of an 'n' glyph
|
||||||
|
$columnWidth += ceil(self::getTextWidthPixelsExact('0', $font, 0) * 1.07); // pixels incl. padding
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
// Width of text in pixels excl. padding, approximation
|
||||||
|
$columnWidth = self::getTextWidthPixelsApprox($columnText, $font, $rotation);
|
||||||
|
|
||||||
|
// Excel adds some padding, just use approx width of 'n' glyph
|
||||||
|
$columnWidth += self::getTextWidthPixelsApprox('n', $font, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert from pixel width to column width
|
||||||
|
$columnWidth = PHPExcel_Shared_Drawing::pixelsToCellDimension($columnWidth, $defaultFont);
|
||||||
|
|
||||||
|
// Return
|
||||||
|
return round($columnWidth, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get GD text width in pixels for a string of text in a certain font at a certain rotation angle
|
||||||
|
*
|
||||||
|
* @param string $text
|
||||||
|
* @param PHPExcel_Style_Font
|
||||||
|
* @param int $rotation
|
||||||
|
* @return int
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static function getTextWidthPixelsExact($text, PHPExcel_Style_Font $font, $rotation = 0) {
|
||||||
|
if (!function_exists('imagettfbbox')) {
|
||||||
|
throw new Exception('GD library needs to be enabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
// font size should really be supplied in pixels in GD2,
|
||||||
|
// but since GD2 seems to assume 72dpi, pixels and points are the same
|
||||||
|
$fontFile = self::getTrueTypeFontFileFromFont($font);
|
||||||
|
$textBox = imagettfbbox($font->getSize(), $rotation, $fontFile, $text);
|
||||||
|
|
||||||
|
// Get corners positions
|
||||||
|
$lowerLeftCornerX = $textBox[0];
|
||||||
|
$lowerLeftCornerY = $textBox[1];
|
||||||
|
$lowerRightCornerX = $textBox[2];
|
||||||
|
$lowerRightCornerY = $textBox[3];
|
||||||
|
$upperRightCornerX = $textBox[4];
|
||||||
|
$upperRightCornerY = $textBox[5];
|
||||||
|
$upperLeftCornerX = $textBox[6];
|
||||||
|
$upperLeftCornerY = $textBox[7];
|
||||||
|
|
||||||
|
// Consider the rotation when calculating the width
|
||||||
|
$textWidth = max($lowerRightCornerX - $upperLeftCornerX, $upperRightCornerX - $lowerLeftCornerX);
|
||||||
|
|
||||||
|
return $textWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get approximate width in pixels for a string of text in a certain font at a certain rotation angle
|
||||||
|
*
|
||||||
|
* @param string $columnText
|
||||||
|
* @param PHPExcel_Style_Font $font
|
||||||
|
* @param int $rotation
|
||||||
|
* @return int Text width in pixels (no padding added)
|
||||||
|
*/
|
||||||
|
public static function getTextWidthPixelsApprox($columnText, PHPExcel_Style_Font $font = null, $rotation = 0)
|
||||||
|
{
|
||||||
|
$fontName = $font->getName();
|
||||||
|
$fontSize = $font->getSize();
|
||||||
|
|
||||||
|
// Calculate column width in pixels. We assume fixed glyph width. Result varies with font name and size.
|
||||||
|
switch ($fontName) {
|
||||||
|
case 'Calibri':
|
||||||
|
// value 8.26 was found via interpolation by inspecting real Excel files with Calibri 11 font.
|
||||||
|
$columnWidth = (int) (8.26 * PHPExcel_Shared_String::CountCharacters($columnText));
|
||||||
|
$columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Arial':
|
||||||
|
// value 7 was found via interpolation by inspecting real Excel files with Arial 10 font.
|
||||||
|
$columnWidth = (int) (7 * PHPExcel_Shared_String::CountCharacters($columnText));
|
||||||
|
$columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Verdana':
|
||||||
|
// value 8 was found via interpolation by inspecting real Excel files with Verdana 10 font.
|
||||||
|
$columnWidth = (int) (8 * PHPExcel_Shared_String::CountCharacters($columnText));
|
||||||
|
$columnWidth = $columnWidth * $fontSize / 10; // extrapolate from font size
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// just assume Calibri
|
||||||
|
$columnWidth = (int) (8.26 * PHPExcel_Shared_String::CountCharacters($columnText));
|
||||||
|
$columnWidth = $columnWidth * $fontSize / 11; // extrapolate from font size
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate approximate rotated column width
|
// Calculate approximate rotated column width
|
||||||
if ($rotation !== 0) {
|
if ($rotation !== 0) {
|
||||||
@@ -101,8 +377,9 @@ class PHPExcel_Shared_Font
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return
|
// pixel width is an integer
|
||||||
return round($columnWidth, 6);
|
$columnWidth = (int) $columnWidth;
|
||||||
|
return $columnWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,8 +388,8 @@ class PHPExcel_Shared_Font
|
|||||||
* @param int $fontSizeInPoints Font size (in points)
|
* @param int $fontSizeInPoints Font size (in points)
|
||||||
* @return int Font size (in pixels)
|
* @return int Font size (in pixels)
|
||||||
*/
|
*/
|
||||||
public static function fontSizeToPixels($fontSizeInPoints = 12) {
|
public static function fontSizeToPixels($fontSizeInPoints = 11) {
|
||||||
return ((16 / 12) * $fontSizeInPoints);
|
return (int) ((4 / 3) * $fontSizeInPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -135,6 +412,133 @@ class PHPExcel_Shared_Font
|
|||||||
return ($sizeInCm * 37.795275591);
|
return ($sizeInCm * 37.795275591);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the font path given the font
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Style_Font
|
||||||
|
* @return string Path to TrueType font file
|
||||||
|
*/
|
||||||
|
public static function getTrueTypeFontFileFromFont($font) {
|
||||||
|
if (!file_exists(self::$trueTypeFontPath) || !is_dir(self::$trueTypeFontPath)) {
|
||||||
|
throw new Exception('Valid directory to TrueType Font files not specified');
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = $font->getName();
|
||||||
|
$bold = $font->getBold();
|
||||||
|
$italic = $font->getItalic();
|
||||||
|
|
||||||
|
// Check if we can map font to true type font file
|
||||||
|
switch ($name) {
|
||||||
|
case 'Arial':
|
||||||
|
$fontFile = (
|
||||||
|
$bold ? ($italic ? self::ARIAL_BOLD_ITALIC : self::ARIAL_BOLD)
|
||||||
|
: ($italic ? self::ARIAL_ITALIC : self::ARIAL)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Calibri':
|
||||||
|
$fontFile = (
|
||||||
|
$bold ? ($italic ? self::CALIBRI_BOLD_ITALIC : self::CALIBRI_BOLD)
|
||||||
|
: ($italic ? self::CALIBRI_ITALIC : self::CALIBRI)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Courier New':
|
||||||
|
$fontFile = (
|
||||||
|
$bold ? ($italic ? self::COURIER_NEW_BOLD_ITALIC : self::COURIER_NEW_BOLD)
|
||||||
|
: ($italic ? self::COURIER_NEW_ITALIC : self::COURIER_NEW)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Comic Sans MS':
|
||||||
|
$fontFile = (
|
||||||
|
$bold ? self::COMIC_SANS_MS_BOLD : self::COMIC_SANS_MS
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Georgia':
|
||||||
|
$fontFile = (
|
||||||
|
$bold ? ($italic ? self::GEORGIA_BOLD_ITALIC : self::GEORGIA_BOLD)
|
||||||
|
: ($italic ? self::GEORGIA_ITALIC : self::GEORGIA)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Impact':
|
||||||
|
$fontFile = self::IMPACT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Liberation Sans':
|
||||||
|
$fontFile = (
|
||||||
|
$bold ? ($italic ? self::LIBERATION_SANS_BOLD_ITALIC : self::LIBERATION_SANS_BOLD)
|
||||||
|
: ($italic ? self::LIBERATION_SANS_ITALIC : self::LIBERATION_SANS)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Lucida Console':
|
||||||
|
$fontFile = self::LUCIDA_CONSOLE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Lucida Sans Unicode':
|
||||||
|
$fontFile = self::LUCIDA_SANS_UNICODE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Microsoft Sans Serif':
|
||||||
|
$fontFile = self::MICROSOFT_SANS_SERIF;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Palatino Linotype':
|
||||||
|
$fontFile = (
|
||||||
|
$bold ? ($italic ? self::PALATINO_LINOTYPE_BOLD_ITALIC : self::PALATINO_LINOTYPE_BOLD)
|
||||||
|
: ($italic ? self::PALATINO_LINOTYPE_ITALIC : self::PALATINO_LINOTYPE)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Symbol':
|
||||||
|
$fontFile = self::SYMBOL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Tahoma':
|
||||||
|
$fontFile = (
|
||||||
|
$bold ? self::TAHOMA_BOLD : self::TAHOMA
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Times New Roman':
|
||||||
|
$fontFile = (
|
||||||
|
$bold ? ($italic ? self::TIMES_NEW_ROMAN_BOLD_ITALIC : self::TIMES_NEW_ROMAN_BOLD)
|
||||||
|
: ($italic ? self::TIMES_NEW_ROMAN_ITALIC : self::TIMES_NEW_ROMAN)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Trebuchet MS':
|
||||||
|
$fontFile = (
|
||||||
|
$bold ? ($italic ? self::TREBUCHET_MS_BOLD_ITALIC : self::TREBUCHET_MS_BOLD)
|
||||||
|
: ($italic ? self::TREBUCHET_MS_ITALIC : self::TREBUCHET_MS)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Verdana':
|
||||||
|
$fontFile = (
|
||||||
|
$bold ? ($italic ? self::VERDANA_BOLD_ITALIC : self::VERDANA_BOLD)
|
||||||
|
: ($italic ? self::VERDANA_ITALIC : self::VERDANA)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Exception('Unknown font name "'. $name .'". Cannot map to TrueType font file');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fontFile = self::$trueTypeFontPath . $fontFile;
|
||||||
|
|
||||||
|
// Check if file actually exists
|
||||||
|
if (!file_exists($fontFile)) {
|
||||||
|
throw New Exception('TrueType Font file not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $fontFile;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the associated charset for the font name.
|
* Returns the associated charset for the font name.
|
||||||
*
|
*
|
||||||
@@ -145,6 +549,7 @@ class PHPExcel_Shared_Font
|
|||||||
{
|
{
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
// Add more cases. Check FONT records in real Excel files.
|
// Add more cases. Check FONT records in real Excel files.
|
||||||
|
case 'EucrosiaUPC': return self::CHARSET_ANSI_THAI;
|
||||||
case 'Wingdings': return self::CHARSET_SYMBOL;
|
case 'Wingdings': return self::CHARSET_SYMBOL;
|
||||||
case 'Wingdings 2': return self::CHARSET_SYMBOL;
|
case 'Wingdings 2': return self::CHARSET_SYMBOL;
|
||||||
case 'Wingdings 3': return self::CHARSET_SYMBOL;
|
case 'Wingdings 3': return self::CHARSET_SYMBOL;
|
||||||
@@ -152,4 +557,214 @@ class PHPExcel_Shared_Font
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the effective column width for columns without a column dimension or column with width -1
|
||||||
|
* For example, for Calibri 11 this is 9.140625 (64 px)
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Style_Font $font The workbooks default font
|
||||||
|
* @param boolean $pPixels true = return column width in pixels, false = return in OOXML units
|
||||||
|
* @return mixed Column width
|
||||||
|
*/
|
||||||
|
public static function getDefaultColumnWidthByFont(PHPExcel_Style_Font $font, $pPixels = false)
|
||||||
|
{
|
||||||
|
if (isset(self::$defaultColumnWidths[$font->getName()][$font->getSize()])) {
|
||||||
|
// Exact width can be determined
|
||||||
|
$columnWidth = $pPixels ?
|
||||||
|
self::$defaultColumnWidths[$font->getName()][$font->getSize()]['px']
|
||||||
|
: self::$defaultColumnWidths[$font->getName()][$font->getSize()]['width'];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// We don't have data for this particular font and size, use approximation by
|
||||||
|
// extrapolating from Calibri 11
|
||||||
|
$columnWidth = $pPixels ?
|
||||||
|
self::$defaultColumnWidths['Calibri'][11]['px']
|
||||||
|
: self::$defaultColumnWidths['Calibri'][11]['width'];
|
||||||
|
$columnWidth = $columnWidth * $font->getSize() / 11;
|
||||||
|
|
||||||
|
// Round pixels to closest integer
|
||||||
|
if ($pPixels) {
|
||||||
|
$columnWidth = (int) round($columnWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $columnWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the effective row height for rows without a row dimension or rows with height -1
|
||||||
|
* For example, for Calibri 11 this is 15 points
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Style_Font $font The workbooks default font
|
||||||
|
* @return float Row height in points
|
||||||
|
*/
|
||||||
|
public static function getDefaultRowHeightByFont(PHPExcel_Style_Font $font)
|
||||||
|
{
|
||||||
|
switch ($font->getName()) {
|
||||||
|
case 'Arial':
|
||||||
|
switch ($font->getSize()) {
|
||||||
|
case 10:
|
||||||
|
// inspection of Arial 10 workbook says 12.75pt ~17px
|
||||||
|
$rowHeight = 12.75;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
// inspection of Arial 9 workbook says 12.00pt ~16px
|
||||||
|
$rowHeight = 12;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
// inspection of Arial 8 workbook says 11.25pt ~15px
|
||||||
|
$rowHeight = 11.25;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7:
|
||||||
|
// inspection of Arial 7 workbook says 9.00pt ~12px
|
||||||
|
$rowHeight = 9;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
case 5:
|
||||||
|
// inspection of Arial 5,6 workbook says 8.25pt ~11px
|
||||||
|
$rowHeight = 8.25;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
// inspection of Arial 4 workbook says 6.75pt ~9px
|
||||||
|
$rowHeight = 6.75;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
// inspection of Arial 3 workbook says 6.00pt ~8px
|
||||||
|
$rowHeight = 6;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
case 1:
|
||||||
|
// inspection of Arial 1,2 workbook says 5.25pt ~7px
|
||||||
|
$rowHeight = 5.25;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// use Arial 10 workbook as an approximation, extrapolation
|
||||||
|
$rowHeight = 12.75 * $font->getSize() / 10;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Calibri':
|
||||||
|
switch ($font->getSize()) {
|
||||||
|
case 11:
|
||||||
|
// inspection of Calibri 11 workbook says 15.00pt ~20px
|
||||||
|
$rowHeight = 15;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 10:
|
||||||
|
// inspection of Calibri 10 workbook says 12.75pt ~17px
|
||||||
|
$rowHeight = 12.75;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
// inspection of Calibri 9 workbook says 12.00pt ~16px
|
||||||
|
$rowHeight = 12;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
// inspection of Calibri 8 workbook says 11.25pt ~15px
|
||||||
|
$rowHeight = 11.25;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7:
|
||||||
|
// inspection of Calibri 7 workbook says 9.00pt ~12px
|
||||||
|
$rowHeight = 9;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
case 5:
|
||||||
|
// inspection of Calibri 5,6 workbook says 8.25pt ~11px
|
||||||
|
$rowHeight = 8.25;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
// inspection of Calibri 4 workbook says 6.75pt ~9px
|
||||||
|
$rowHeight = 6.75;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
// inspection of Calibri 3 workbook says 6.00pt ~8px
|
||||||
|
$rowHeight = 6.00;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
case 1:
|
||||||
|
// inspection of Calibri 1,2 workbook says 5.25pt ~7px
|
||||||
|
$rowHeight = 5.25;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// use Calibri 11 workbook as an approximation, extrapolation
|
||||||
|
$rowHeight = 15 * $font->getSize() / 11;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Verdana':
|
||||||
|
switch ($font->getSize()) {
|
||||||
|
case 10:
|
||||||
|
// inspection of Verdana 10 workbook says 12.75pt ~17px
|
||||||
|
$rowHeight = 12.75;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 9:
|
||||||
|
// inspection of Verdana 9 workbook says 11.25pt ~15px
|
||||||
|
$rowHeight = 11.25;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
// inspection of Verdana 8 workbook says 10.50pt ~14px
|
||||||
|
$rowHeight = 10.50;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 7:
|
||||||
|
// inspection of Verdana 7 workbook says 9.00pt ~12px
|
||||||
|
$rowHeight = 9.00;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 6:
|
||||||
|
case 5:
|
||||||
|
// inspection of Verdana 5,6 workbook says 8.25pt ~11px
|
||||||
|
$rowHeight = 8.25;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
// inspection of Verdana 4 workbook says 6.75pt ~9px
|
||||||
|
$rowHeight = 6.75;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
// inspection of Verdana 3 workbook says 6.00pt ~8px
|
||||||
|
$rowHeight = 6;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
case 1:
|
||||||
|
// inspection of Verdana 1,2 workbook says 5.25pt ~7px
|
||||||
|
$rowHeight = 5.25;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// use Verdana 10 workbook as an approximation, extrapolation
|
||||||
|
$rowHeight = 12.75 * $font->getSize() / 10;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// just use Calibri as an approximation
|
||||||
|
$rowHeight = 15 * $font->getSize() / 11;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rowHeight;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -21,6 +21,8 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/LUDecomposition.php';
|
|||||||
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/QRDecomposition.php';
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/QRDecomposition.php';
|
||||||
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/EigenvalueDecomposition.php';
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/EigenvalueDecomposition.php';
|
||||||
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/SingularValueDecomposition.php';
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/SingularValueDecomposition.php';
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php';
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation/Functions.php';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Matrix class
|
* Matrix class
|
||||||
@@ -760,7 +762,21 @@ class Matrix {
|
|||||||
$this->checkMatrixDimensions($M);
|
$this->checkMatrixDimensions($M);
|
||||||
for($i = 0; $i < $this->m; ++$i) {
|
for($i = 0; $i < $this->m; ++$i) {
|
||||||
for($j = 0; $j < $this->n; ++$j) {
|
for($j = 0; $j < $this->n; ++$j) {
|
||||||
$this->A[$i][$j] += $M->get($i, $j);
|
$validValues = True;
|
||||||
|
$value = $M->get($i, $j);
|
||||||
|
if ((is_string($this->A[$i][$j])) && (!is_numeric($this->A[$i][$j]))) {
|
||||||
|
$this->A[$i][$j] = trim($this->A[$i][$j],'"');
|
||||||
|
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
|
||||||
|
}
|
||||||
|
if ((is_string($value)) && (!is_numeric($value))) {
|
||||||
|
$value = trim($value,'"');
|
||||||
|
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
|
||||||
|
}
|
||||||
|
if ($validValues) {
|
||||||
|
$this->A[$i][$j] += $value;
|
||||||
|
} else {
|
||||||
|
$this->A[$i][$j] = PHPExcel_Calculation_Functions::NaN();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
@@ -832,7 +848,21 @@ class Matrix {
|
|||||||
$this->checkMatrixDimensions($M);
|
$this->checkMatrixDimensions($M);
|
||||||
for($i = 0; $i < $this->m; ++$i) {
|
for($i = 0; $i < $this->m; ++$i) {
|
||||||
for($j = 0; $j < $this->n; ++$j) {
|
for($j = 0; $j < $this->n; ++$j) {
|
||||||
$this->A[$i][$j] -= $M->get($i, $j);
|
$validValues = True;
|
||||||
|
$value = $M->get($i, $j);
|
||||||
|
if ((is_string($this->A[$i][$j])) && (!is_numeric($this->A[$i][$j]))) {
|
||||||
|
$this->A[$i][$j] = trim($this->A[$i][$j],'"');
|
||||||
|
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
|
||||||
|
}
|
||||||
|
if ((is_string($value)) && (!is_numeric($value))) {
|
||||||
|
$value = trim($value,'"');
|
||||||
|
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
|
||||||
|
}
|
||||||
|
if ($validValues) {
|
||||||
|
$this->A[$i][$j] -= $value;
|
||||||
|
} else {
|
||||||
|
$this->A[$i][$j] = PHPExcel_Calculation_Functions::NaN();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
@@ -906,7 +936,21 @@ class Matrix {
|
|||||||
$this->checkMatrixDimensions($M);
|
$this->checkMatrixDimensions($M);
|
||||||
for($i = 0; $i < $this->m; ++$i) {
|
for($i = 0; $i < $this->m; ++$i) {
|
||||||
for($j = 0; $j < $this->n; ++$j) {
|
for($j = 0; $j < $this->n; ++$j) {
|
||||||
$this->A[$i][$j] *= $M->get($i, $j);
|
$validValues = True;
|
||||||
|
$value = $M->get($i, $j);
|
||||||
|
if ((is_string($this->A[$i][$j])) && (!is_numeric($this->A[$i][$j]))) {
|
||||||
|
$this->A[$i][$j] = trim($this->A[$i][$j],'"');
|
||||||
|
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
|
||||||
|
}
|
||||||
|
if ((is_string($value)) && (!is_numeric($value))) {
|
||||||
|
$value = trim($value,'"');
|
||||||
|
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
|
||||||
|
}
|
||||||
|
if ($validValues) {
|
||||||
|
$this->A[$i][$j] *= $value;
|
||||||
|
} else {
|
||||||
|
$this->A[$i][$j] = PHPExcel_Calculation_Functions::NaN();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
@@ -943,7 +987,26 @@ class Matrix {
|
|||||||
$this->checkMatrixDimensions($M);
|
$this->checkMatrixDimensions($M);
|
||||||
for($i = 0; $i < $this->m; ++$i) {
|
for($i = 0; $i < $this->m; ++$i) {
|
||||||
for($j = 0; $j < $this->n; ++$j) {
|
for($j = 0; $j < $this->n; ++$j) {
|
||||||
$M->set($i, $j, $this->A[$i][$j] / $M->get($i, $j));
|
$validValues = True;
|
||||||
|
$value = $M->get($i, $j);
|
||||||
|
if ((is_string($this->A[$i][$j])) && (!is_numeric($this->A[$i][$j]))) {
|
||||||
|
$this->A[$i][$j] = trim($this->A[$i][$j],'"');
|
||||||
|
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
|
||||||
|
}
|
||||||
|
if ((is_string($value)) && (!is_numeric($value))) {
|
||||||
|
$value = trim($value,'"');
|
||||||
|
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
|
||||||
|
}
|
||||||
|
if ($validValues) {
|
||||||
|
if ($value == 0) {
|
||||||
|
// Trap for Divide by Zero error
|
||||||
|
$M->set($i, $j, '#DIV/0!');
|
||||||
|
} else {
|
||||||
|
$M->set($i, $j, $this->A[$i][$j] / $value);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->A[$i][$j] = PHPExcel_Calculation_Functions::NaN();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $M;
|
return $M;
|
||||||
@@ -1181,7 +1244,21 @@ class Matrix {
|
|||||||
$this->checkMatrixDimensions($M);
|
$this->checkMatrixDimensions($M);
|
||||||
for($i = 0; $i < $this->m; ++$i) {
|
for($i = 0; $i < $this->m; ++$i) {
|
||||||
for($j = 0; $j < $this->n; ++$j) {
|
for($j = 0; $j < $this->n; ++$j) {
|
||||||
$this->A[$i][$j] = pow($this->A[$i][$j],$M->get($i, $j));
|
$validValues = True;
|
||||||
|
$value = $M->get($i, $j);
|
||||||
|
if ((is_string($this->A[$i][$j])) && (!is_numeric($this->A[$i][$j]))) {
|
||||||
|
$this->A[$i][$j] = trim($this->A[$i][$j],'"');
|
||||||
|
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($this->A[$i][$j]);
|
||||||
|
}
|
||||||
|
if ((is_string($value)) && (!is_numeric($value))) {
|
||||||
|
$value = trim($value,'"');
|
||||||
|
$validValues &= PHPExcel_Shared_String::convertToNumberIfFraction($value);
|
||||||
|
}
|
||||||
|
if ($validValues) {
|
||||||
|
$this->A[$i][$j] = pow($this->A[$i][$j],$value);
|
||||||
|
} else {
|
||||||
|
$this->A[$i][$j] = PHPExcel_Calculation_Functions::NaN();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006 - 2009 PHPExcel
|
* Copyright (C) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* @package PHPExcel_Shared_OLE
|
* @package PHPExcel_Shared_OLE
|
||||||
* @copyright Copyright (c) 2006 - 2007 Christian Schmidt
|
* @copyright Copyright (c) 2006 - 2007 Christian Schmidt
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPExcel root directory */
|
/** PHPExcel root directory */
|
||||||
|
@@ -248,7 +248,7 @@ class PHPExcel_Shared_OLE_PPS_Root extends PHPExcel_Shared_OLE_PPS
|
|||||||
. pack("V", 0)
|
. pack("V", 0)
|
||||||
. pack("V", 0x1000)
|
. pack("V", 0x1000)
|
||||||
. pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot
|
. pack("V", $iSBDcnt ? 0 : -2) //Small Block Depot
|
||||||
. pack("V", 1)
|
. pack("V", $iSBDcnt)
|
||||||
);
|
);
|
||||||
// Extra BDList Start, Count
|
// Extra BDList Start, Count
|
||||||
if ($iBdCnt < $i1stBdL) {
|
if ($iBdCnt < $i1stBdL) {
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1));
|
define('IDENTIFIER_OLE', pack('CCCCCCCC', 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1));
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_PasswordHasher
|
class PHPExcel_Shared_PasswordHasher
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,10 +31,16 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_String
|
class PHPExcel_Shared_String
|
||||||
{
|
{
|
||||||
|
/** Constants */
|
||||||
|
/** Regular Expressions */
|
||||||
|
// Fraction
|
||||||
|
const STRING_REGEXP_FRACTION = '(-?)(\d+)\s+(\d+\/\d+)';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Control characters array
|
* Control characters array
|
||||||
*
|
*
|
||||||
@@ -42,6 +48,20 @@ class PHPExcel_Shared_String
|
|||||||
*/
|
*/
|
||||||
private static $_controlCharacters = array();
|
private static $_controlCharacters = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decimal separator
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private static $_decimalSeparator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thousands separator
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private static $_thousandsSeparator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is mbstring extension avalable?
|
* Is mbstring extension avalable?
|
||||||
*
|
*
|
||||||
@@ -60,7 +80,7 @@ class PHPExcel_Shared_String
|
|||||||
* Build control characters array
|
* Build control characters array
|
||||||
*/
|
*/
|
||||||
private static function _buildControlCharacters() {
|
private static function _buildControlCharacters() {
|
||||||
for ($i = 0; $i <= 19; ++$i) {
|
for ($i = 0; $i <= 31; ++$i) {
|
||||||
if ($i != 9 && $i != 10 && $i != 13) {
|
if ($i != 9 && $i != 10 && $i != 13) {
|
||||||
$find = '_x' . sprintf('%04s' , strtoupper(dechex($i))) . '_';
|
$find = '_x' . sprintf('%04s' , strtoupper(dechex($i))) . '_';
|
||||||
$replace = chr($i);
|
$replace = chr($i);
|
||||||
@@ -97,12 +117,19 @@ class PHPExcel_Shared_String
|
|||||||
return self::$_isIconvEnabled;
|
return self::$_isIconvEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IBM AIX iconv() does not work
|
// Check that iconv exists
|
||||||
self::$_isIconvEnabled = function_exists('iconv') &&
|
// Sometimes iconv is not working, and e.g. iconv('UTF-8', 'UTF-16LE', 'x') just returns false,
|
||||||
!(defined('PHP_OS') && @stristr(PHP_OS, 'AIX') && defined('ICONV_IMPL')
|
// we cannot use iconv when that happens
|
||||||
&& (@strcasecmp(ICONV_IMPL, 'unknown') == 0) && defined('ICONV_VERSION')
|
// Also, sometimes iconv_substr('A', 0, 1, 'UTF-8') just returns false in PHP 5.2.0
|
||||||
&& (@strcasecmp(ICONV_VERSION, 'unknown') == 0)) ?
|
// we cannot use iconv in that case either (http://bugs.php.net/bug.php?id=37773)
|
||||||
true : false;
|
if (function_exists('iconv')
|
||||||
|
&& @iconv('UTF-8', 'UTF-16LE', 'x')
|
||||||
|
&& @iconv_substr('A', 0, 1, 'UTF-8') ) {
|
||||||
|
|
||||||
|
self::$_isIconvEnabled = true;
|
||||||
|
} else {
|
||||||
|
self::$_isIconvEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
return self::$_isIconvEnabled;
|
return self::$_isIconvEnabled;
|
||||||
}
|
}
|
||||||
@@ -322,4 +349,82 @@ class PHPExcel_Shared_String
|
|||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identify whether a string contains a fractional numeric value,
|
||||||
|
* and convert it to a numeric if it is
|
||||||
|
*
|
||||||
|
* @param string &$operand string value to test
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public static function convertToNumberIfFraction(&$operand) {
|
||||||
|
if (preg_match('/^'.self::STRING_REGEXP_FRACTION.'$/i', $operand, $match)) {
|
||||||
|
$sign = ($match[1] == '-') ? '-' : '+';
|
||||||
|
$fractionFormula = '='.$sign.$match[2].$sign.$match[3];
|
||||||
|
$operand = PHPExcel_Calculation::getInstance()->_calculateFormulaValue($fractionFormula);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} // function convertToNumberIfFraction()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the decimal separator. If it has not yet been set explicitly, try to obtain number
|
||||||
|
* formatting information from locale.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getDecimalSeparator()
|
||||||
|
{
|
||||||
|
if (!isset(self::$_decimalSeparator)) {
|
||||||
|
$localeconv = localeconv();
|
||||||
|
self::$_decimalSeparator = $localeconv['decimal_point'] != ''
|
||||||
|
? $localeconv['decimal_point'] : $localeconv['mon_decimal_point'];
|
||||||
|
|
||||||
|
if (self::$_decimalSeparator == '')
|
||||||
|
{
|
||||||
|
// Default to .
|
||||||
|
self::$_decimalSeparator = '.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return self::$_decimalSeparator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the decimal separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString()
|
||||||
|
* to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF
|
||||||
|
*
|
||||||
|
* @param string $pValue Character for decimal separator
|
||||||
|
*/
|
||||||
|
public static function setDecimalSeparator($pValue = '.')
|
||||||
|
{
|
||||||
|
self::$_decimalSeparator = $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the thousands separator. If it has not yet been set explicitly, try to obtain number
|
||||||
|
* formatting information from locale.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getThousandsSeparator()
|
||||||
|
{
|
||||||
|
if (!isset(self::$_thousandsSeparator)) {
|
||||||
|
$localeconv = localeconv();
|
||||||
|
self::$_thousandsSeparator = $localeconv['thousands_sep'] != ''
|
||||||
|
? $localeconv['thousands_sep'] : $localeconv['mon_thousands_sep'];
|
||||||
|
}
|
||||||
|
return self::$_thousandsSeparator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the thousands separator. Only used by PHPExcel_Style_NumberFormat::toFormattedString()
|
||||||
|
* to format output by PHPExcel_Writer_HTML and PHPExcel_Writer_PDF
|
||||||
|
*
|
||||||
|
* @param string $pValue Character for thousands separator
|
||||||
|
*/
|
||||||
|
public static function setThousandsSeparator($pValue = ',')
|
||||||
|
{
|
||||||
|
self::$_thousandsSeparator = $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('DATE_W3C')) {
|
if (!defined('DATE_W3C')) {
|
||||||
@@ -34,7 +34,7 @@ if (!defined('DATE_W3C')) {
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_XMLWriter {
|
class PHPExcel_Shared_XMLWriter {
|
||||||
/** Temporary storage method */
|
/** Temporary storage method */
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ PHPExcel_Shared_ZipStreamWrapper::register();
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared
|
* @package PHPExcel_Shared
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Shared_ZipStreamWrapper {
|
class PHPExcel_Shared_ZipStreamWrapper {
|
||||||
/**
|
/**
|
||||||
@@ -84,7 +84,7 @@ class PHPExcel_Shared_ZipStreamWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse URL
|
// Parse URL
|
||||||
$url = @parse_url($path);
|
$url = @parse_url(str_replace('zip://', 'file://', $path));
|
||||||
|
|
||||||
// Fix URL
|
// Fix URL
|
||||||
if (!is_array($url)) {
|
if (!is_array($url)) {
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Best_Fit
|
* @package PHPExcel_Shared_Best_Fit
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Best_Fit
|
* @package PHPExcel_Shared_Best_Fit
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Best_Fit
|
class PHPExcel_Best_Fit
|
||||||
{
|
{
|
||||||
@@ -239,7 +239,11 @@ class PHPExcel_Best_Fit
|
|||||||
$this->_SSResiduals = $SSres;
|
$this->_SSResiduals = $SSres;
|
||||||
$this->_DFResiduals = $this->_valueCount - 1 - $const;
|
$this->_DFResiduals = $this->_valueCount - 1 - $const;
|
||||||
|
|
||||||
|
if ($this->_DFResiduals == 0.0) {
|
||||||
|
$this->_stdevOfResiduals = 0.0;
|
||||||
|
} else {
|
||||||
$this->_stdevOfResiduals = sqrt($SSres / $this->_DFResiduals);
|
$this->_stdevOfResiduals = sqrt($SSres / $this->_DFResiduals);
|
||||||
|
}
|
||||||
if (($SStot == 0.0) || ($SSres == $SStot)) {
|
if (($SStot == 0.0) || ($SSres == $SStot)) {
|
||||||
$this->_goodnessOfFit = 1;
|
$this->_goodnessOfFit = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -252,10 +256,18 @@ class PHPExcel_Best_Fit
|
|||||||
$this->_slopeSE = $this->_stdevOfResiduals / sqrt($SSsex);
|
$this->_slopeSE = $this->_stdevOfResiduals / sqrt($SSsex);
|
||||||
$this->_intersectSE = $this->_stdevOfResiduals * sqrt(1 / ($this->_valueCount - ($sumX * $sumX) / $sumX2));
|
$this->_intersectSE = $this->_stdevOfResiduals * sqrt(1 / ($this->_valueCount - ($sumX * $sumX) / $sumX2));
|
||||||
if ($this->_SSResiduals != 0.0) {
|
if ($this->_SSResiduals != 0.0) {
|
||||||
|
if ($this->_DFResiduals == 0.0) {
|
||||||
|
$this->_F = 0.0;
|
||||||
|
} else {
|
||||||
$this->_F = $this->_SSRegression / ($this->_SSResiduals / $this->_DFResiduals);
|
$this->_F = $this->_SSRegression / ($this->_SSResiduals / $this->_DFResiduals);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($this->_DFResiduals == 0.0) {
|
||||||
|
$this->_F = 0.0;
|
||||||
} else {
|
} else {
|
||||||
$this->_F = $this->_SSRegression / $this->_DFResiduals;
|
$this->_F = $this->_SSRegression / $this->_DFResiduals;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} // function _calculateGoodnessOfFit()
|
} // function _calculateGoodnessOfFit()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Best_Fit
|
* @package PHPExcel_Shared_Best_Fit
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Best_Fit
|
* @package PHPExcel_Shared_Best_Fit
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
||||||
{
|
{
|
||||||
@@ -84,8 +84,14 @@ class PHPExcel_Exponential_Best_Fit extends PHPExcel_Best_Fit
|
|||||||
|
|
||||||
|
|
||||||
private function _exponential_regression($yValues, $xValues, $const) {
|
private function _exponential_regression($yValues, $xValues, $const) {
|
||||||
$mArray = $xValues;
|
foreach($yValues as &$value) {
|
||||||
$yValues = array_map('log',$yValues);
|
if ($value < 0.0) {
|
||||||
|
$value = 0 - log(abs($value));
|
||||||
|
} elseif ($value > 0.0) {
|
||||||
|
$value = log($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($value);
|
||||||
|
|
||||||
$this->_leastSquareFit($yValues, $xValues, $const);
|
$this->_leastSquareFit($yValues, $xValues, $const);
|
||||||
} // function _exponential_regression()
|
} // function _exponential_regression()
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Best_Fit
|
* @package PHPExcel_Shared_Best_Fit
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Best_Fit
|
* @package PHPExcel_Shared_Best_Fit
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
|
class PHPExcel_Linear_Best_Fit extends PHPExcel_Best_Fit
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Best_Fit
|
* @package PHPExcel_Shared_Best_Fit
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ require_once(PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php');
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Best_Fit
|
* @package PHPExcel_Shared_Best_Fit
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
|
class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
|
||||||
{
|
{
|
||||||
@@ -68,8 +68,14 @@ class PHPExcel_Logarithmic_Best_Fit extends PHPExcel_Best_Fit
|
|||||||
|
|
||||||
|
|
||||||
private function _logarithmic_regression($yValues, $xValues, $const) {
|
private function _logarithmic_regression($yValues, $xValues, $const) {
|
||||||
$mArray = $xValues;
|
foreach($xValues as &$value) {
|
||||||
$xValues = array_map('log',$xValues);
|
if ($value < 0.0) {
|
||||||
|
$value = 0 - log(abs($value));
|
||||||
|
} elseif ($value > 0.0) {
|
||||||
|
$value = log($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($value);
|
||||||
|
|
||||||
$this->_leastSquareFit($yValues, $xValues, $const);
|
$this->_leastSquareFit($yValues, $xValues, $const);
|
||||||
} // function _logarithmic_regression()
|
} // function _logarithmic_regression()
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Best_Fit
|
* @package PHPExcel_Shared_Best_Fit
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/JAMA/Matrix.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Best_Fit
|
* @package PHPExcel_Shared_Best_Fit
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
class PHPExcel_Polynomial_Best_Fit extends PHPExcel_Best_Fit
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Best_Fit
|
* @package PHPExcel_Shared_Best_Fit
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/trend/bestFitClass.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Shared_Best_Fit
|
* @package PHPExcel_Shared_Best_Fit
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
||||||
{
|
{
|
||||||
@@ -76,10 +76,22 @@ class PHPExcel_Power_Best_Fit extends PHPExcel_Best_Fit
|
|||||||
|
|
||||||
|
|
||||||
private function _power_regression($yValues, $xValues, $const) {
|
private function _power_regression($yValues, $xValues, $const) {
|
||||||
$mArray = $xValues;
|
foreach($xValues as &$value) {
|
||||||
sort($mArray,SORT_NUMERIC);
|
if ($value < 0.0) {
|
||||||
$xValues = array_map('log',$xValues);
|
$value = 0 - log(abs($value));
|
||||||
$yValues = array_map('log',$yValues);
|
} elseif ($value > 0.0) {
|
||||||
|
$value = log($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($value);
|
||||||
|
foreach($yValues as &$value) {
|
||||||
|
if ($value < 0.0) {
|
||||||
|
$value = 0 - log(abs($value));
|
||||||
|
} elseif ($value > 0.0) {
|
||||||
|
$value = log($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($value);
|
||||||
|
|
||||||
$this->_leastSquareFit($yValues, $xValues, $const);
|
$this->_leastSquareFit($yValues, $xValues, $const);
|
||||||
} // function _power_regression()
|
} // function _power_regression()
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Style implements PHPExcel_IComparable
|
class PHPExcel_Style implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -201,7 +201,7 @@ class PHPExcel_Style implements PHPExcel_IComparable
|
|||||||
public function getSharedComponent()
|
public function getSharedComponent()
|
||||||
{
|
{
|
||||||
$activeSheet = $this->getActiveSheet();
|
$activeSheet = $this->getActiveSheet();
|
||||||
$selectedCell = $this->getXActiveCell(); // e.g. 'A1'
|
$selectedCell = $this->getActiveCell(); // e.g. 'A1'
|
||||||
|
|
||||||
if ($activeSheet->cellExists($selectedCell)) {
|
if ($activeSheet->cellExists($selectedCell)) {
|
||||||
$cell = $activeSheet->getCell($selectedCell);
|
$cell = $activeSheet->getCell($selectedCell);
|
||||||
@@ -230,9 +230,9 @@ class PHPExcel_Style implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXSelectedCells()
|
public function getSelectedCells()
|
||||||
{
|
{
|
||||||
return $this->_parent->getActiveSheet()->getXSelectedCells();
|
return $this->_parent->getActiveSheet()->getSelectedCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -241,9 +241,9 @@ class PHPExcel_Style implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXActiveCell()
|
public function getActiveCell()
|
||||||
{
|
{
|
||||||
return $this->_parent->getActiveSheet()->getXActiveCell();
|
return $this->_parent->getActiveSheet()->getActiveCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -299,9 +299,8 @@ class PHPExcel_Style implements PHPExcel_IComparable
|
|||||||
if (is_array($pStyles)) {
|
if (is_array($pStyles)) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
|
|
||||||
$pRange = $this->getXSelectedCells();
|
$pRange = $this->getSelectedCells();
|
||||||
|
|
||||||
if (is_array($pStyles)) {
|
|
||||||
// Uppercase coordinate
|
// Uppercase coordinate
|
||||||
$pRange = strtoupper($pRange);
|
$pRange = strtoupper($pRange);
|
||||||
|
|
||||||
@@ -330,7 +329,8 @@ class PHPExcel_Style implements PHPExcel_IComparable
|
|||||||
$rangeEnd = $tmp;
|
$rangeEnd = $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Advanced mode
|
// ADVANCED MODE:
|
||||||
|
|
||||||
if ($pAdvanced && isset($pStyles['borders'])) {
|
if ($pAdvanced && isset($pStyles['borders'])) {
|
||||||
|
|
||||||
// 'allborders' is a shorthand property for 'outline' and 'inside' and
|
// 'allborders' is a shorthand property for 'outline' and 'inside' and
|
||||||
@@ -456,15 +456,46 @@ class PHPExcel_Style implements PHPExcel_IComparable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simple mode
|
// SIMPLE MODE:
|
||||||
|
|
||||||
// First loop through cells to find out which styles are affected by this operation
|
// Selection type, inspect
|
||||||
|
if (preg_match('/^[A-Z]+1:[A-Z]+1048576$/', $pRange)) {
|
||||||
|
$selectionType = 'COLUMN';
|
||||||
|
} else if (preg_match('/^A[0-9]+:XFD[0-9]+$/', $pRange)) {
|
||||||
|
$selectionType = 'ROW';
|
||||||
|
} else {
|
||||||
|
$selectionType = 'CELL';
|
||||||
|
}
|
||||||
|
|
||||||
|
// First loop through columns, rows, or cells to find out which styles are affected by this operation
|
||||||
|
switch ($selectionType) {
|
||||||
|
case 'COLUMN':
|
||||||
|
$oldXfIndexes = array();
|
||||||
|
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
|
||||||
|
$oldXfIndexes[$this->getActiveSheet()->getColumnDimensionByColumn($col)->getXfIndex()] = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ROW':
|
||||||
|
$oldXfIndexes = array();
|
||||||
|
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
|
||||||
|
if ($this->getActiveSheet()->getRowDimension($row)->getXfIndex() == null) {
|
||||||
|
$oldXfIndexes[0] = true; // row without explicit style should be formatted based on default style
|
||||||
|
} else {
|
||||||
|
$oldXfIndexes[$this->getActiveSheet()->getRowDimension($row)->getXfIndex()] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'CELL':
|
||||||
$oldXfIndexes = array();
|
$oldXfIndexes = array();
|
||||||
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
|
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
|
||||||
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
|
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
|
||||||
$oldXfIndexes[$this->getActiveSheet()->getCellByColumnAndRow($col, $row)->getXfIndex()] = true;
|
$oldXfIndexes[$this->getActiveSheet()->getCellByColumnAndRow($col, $row)->getXfIndex()] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// clone each of the affected styles, apply the style arrray, and add the new styles to the workbook
|
// clone each of the affected styles, apply the style arrray, and add the new styles to the workbook
|
||||||
$workbook = $this->getActiveSheet()->getParent();
|
$workbook = $this->getActiveSheet()->getParent();
|
||||||
@@ -483,7 +514,26 @@ class PHPExcel_Style implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop through cells again and update the XF index
|
// Loop through columns, rows, or cells again and update the XF index
|
||||||
|
switch ($selectionType) {
|
||||||
|
case 'COLUMN':
|
||||||
|
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
|
||||||
|
$columnDimension = $this->getActiveSheet()->getColumnDimensionByColumn($col);
|
||||||
|
$oldXfIndex = $columnDimension->getXfIndex();
|
||||||
|
$columnDimension->setXfIndex($newXfIndexes[$oldXfIndex]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'ROW':
|
||||||
|
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
|
||||||
|
$rowDimension = $this->getActiveSheet()->getRowDimension($row);
|
||||||
|
$oldXfIndex = $rowDimension->getXfIndex() === null ?
|
||||||
|
0 : $rowDimension->getXfIndex(); // row without explicit style should be formatted based on default style
|
||||||
|
$rowDimension->setXfIndex($newXfIndexes[$oldXfIndex]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'CELL':
|
||||||
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
|
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
|
||||||
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
|
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
|
||||||
$cell = $this->getActiveSheet()->getCellByColumnAndRow($col, $row);
|
$cell = $this->getActiveSheet()->getCellByColumnAndRow($col, $row);
|
||||||
@@ -491,12 +541,11 @@ class PHPExcel_Style implements PHPExcel_IComparable
|
|||||||
$cell->setXfIndex($newXfIndexes[$oldXfIndex]);
|
$cell->setXfIndex($newXfIndexes[$oldXfIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
} else {
|
|
||||||
throw new Exception("Invalid style array passed.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// not a supervisor, just apply the style array directly on style object
|
||||||
if (array_key_exists('fill', $pStyles)) {
|
if (array_key_exists('fill', $pStyles)) {
|
||||||
$this->getFill()->applyFromArray($pStyles['fill']);
|
$this->getFill()->applyFromArray($pStyles['fill']);
|
||||||
}
|
}
|
||||||
@@ -585,7 +634,7 @@ class PHPExcel_Style implements PHPExcel_IComparable
|
|||||||
* @return PHPExcel_Style_Conditional[]
|
* @return PHPExcel_Style_Conditional[]
|
||||||
*/
|
*/
|
||||||
public function getConditionalStyles() {
|
public function getConditionalStyles() {
|
||||||
return $this->getActiveSheet()->getConditionalStyles($this->getXActiveCell());
|
return $this->getActiveSheet()->getConditionalStyles($this->getActiveCell());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -596,7 +645,7 @@ class PHPExcel_Style implements PHPExcel_IComparable
|
|||||||
*/
|
*/
|
||||||
public function setConditionalStyles($pValue = null) {
|
public function setConditionalStyles($pValue = null) {
|
||||||
if (is_array($pValue)) {
|
if (is_array($pValue)) {
|
||||||
foreach (PHPExcel_Cell::extractAllCellReferencesInRange($this->getXSelectedCells()) as $cellReference) {
|
foreach (PHPExcel_Cell::extractAllCellReferencesInRange($this->getSelectedCells()) as $cellReference) {
|
||||||
$this->getActiveSheet()->setConditionalStyles($cellReference, $pValue);
|
$this->getActiveSheet()->setConditionalStyles($cellReference, $pValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -635,37 +684,6 @@ class PHPExcel_Style implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get own index in style collection
|
* Get own index in style collection
|
||||||
*
|
*
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Style_Alignment implements PHPExcel_IComparable
|
class PHPExcel_Style_Alignment implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -190,9 +190,9 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXSelectedCells()
|
public function getSelectedCells()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXSelectedCells();
|
return $this->getActiveSheet()->getSelectedCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -201,9 +201,9 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXActiveCell()
|
public function getActiveCell()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXActiveCell();
|
return $this->getActiveSheet()->getActiveCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -238,7 +238,7 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
|
|||||||
public function applyFromArray($pStyles = null) {
|
public function applyFromArray($pStyles = null) {
|
||||||
if (is_array($pStyles)) {
|
if (is_array($pStyles)) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||||
} else {
|
} else {
|
||||||
if (array_key_exists('horizontal', $pStyles)) {
|
if (array_key_exists('horizontal', $pStyles)) {
|
||||||
$this->setHorizontal($pStyles['horizontal']);
|
$this->setHorizontal($pStyles['horizontal']);
|
||||||
@@ -290,7 +290,7 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
|
|||||||
|
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('horizontal' => $pValue));
|
$styleArray = $this->getStyleArray(array('horizontal' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->_horizontal = $pValue;
|
$this->_horizontal = $pValue;
|
||||||
@@ -323,7 +323,7 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
|
|||||||
|
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('vertical' => $pValue));
|
$styleArray = $this->getStyleArray(array('vertical' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_vertical = $pValue;
|
$this->_vertical = $pValue;
|
||||||
}
|
}
|
||||||
@@ -359,7 +359,7 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
|
|||||||
if ( ($pValue >= -90 && $pValue <= 90) || $pValue == -165 ) {
|
if ( ($pValue >= -90 && $pValue <= 90) || $pValue == -165 ) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('rotation' => $pValue));
|
$styleArray = $this->getStyleArray(array('rotation' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_textRotation = $pValue;
|
$this->_textRotation = $pValue;
|
||||||
}
|
}
|
||||||
@@ -394,7 +394,7 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('wrap' => $pValue));
|
$styleArray = $this->getStyleArray(array('wrap' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_wrapText = $pValue;
|
$this->_wrapText = $pValue;
|
||||||
}
|
}
|
||||||
@@ -425,7 +425,7 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('shrinkToFit' => $pValue));
|
$styleArray = $this->getStyleArray(array('shrinkToFit' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_shrinkToFit = $pValue;
|
$this->_shrinkToFit = $pValue;
|
||||||
}
|
}
|
||||||
@@ -458,7 +458,7 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('indent' => $pValue));
|
$styleArray = $this->getStyleArray(array('indent' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_indent = $pValue;
|
$this->_indent = $pValue;
|
||||||
}
|
}
|
||||||
@@ -485,37 +485,6 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Style_Border implements PHPExcel_IComparable
|
class PHPExcel_Style_Border implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -200,9 +200,9 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXSelectedCells()
|
public function getSelectedCells()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXSelectedCells();
|
return $this->getActiveSheet()->getSelectedCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -211,9 +211,9 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXActiveCell()
|
public function getActiveCell()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXActiveCell();
|
return $this->getActiveSheet()->getActiveCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -289,7 +289,7 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
|
|||||||
public function applyFromArray($pStyles = null) {
|
public function applyFromArray($pStyles = null) {
|
||||||
if (is_array($pStyles)) {
|
if (is_array($pStyles)) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||||
} else {
|
} else {
|
||||||
if (array_key_exists('style', $pStyles)) {
|
if (array_key_exists('style', $pStyles)) {
|
||||||
$this->setBorderStyle($pStyles['style']);
|
$this->setBorderStyle($pStyles['style']);
|
||||||
@@ -329,7 +329,7 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('style' => $pValue));
|
$styleArray = $this->getStyleArray(array('style' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_borderStyle = $pValue;
|
$this->_borderStyle = $pValue;
|
||||||
}
|
}
|
||||||
@@ -358,7 +358,7 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
|
|||||||
|
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getColor()->getStyleArray(array('argb' => $color->getARGB()));
|
$styleArray = $this->getColor()->getStyleArray(array('argb' => $color->getARGB()));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_color = $color;
|
$this->_color = $color;
|
||||||
}
|
}
|
||||||
@@ -381,37 +381,6 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Style_Borders implements PHPExcel_IComparable
|
class PHPExcel_Style_Borders implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -54,6 +54,7 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable
|
|||||||
const DIAGONAL_NONE = 0;
|
const DIAGONAL_NONE = 0;
|
||||||
const DIAGONAL_UP = 1;
|
const DIAGONAL_UP = 1;
|
||||||
const DIAGONAL_DOWN = 2;
|
const DIAGONAL_DOWN = 2;
|
||||||
|
const DIAGONAL_BOTH = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Left
|
* Left
|
||||||
@@ -241,9 +242,9 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXSelectedCells()
|
public function getSelectedCells()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXSelectedCells();
|
return $this->getActiveSheet()->getSelectedCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -252,9 +253,9 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXActiveCell()
|
public function getActiveCell()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXActiveCell();
|
return $this->getActiveSheet()->getActiveCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -309,7 +310,7 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable
|
|||||||
public function applyFromArray($pStyles = null) {
|
public function applyFromArray($pStyles = null) {
|
||||||
if (is_array($pStyles)) {
|
if (is_array($pStyles)) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||||
} else {
|
} else {
|
||||||
if (array_key_exists('left', $pStyles)) {
|
if (array_key_exists('left', $pStyles)) {
|
||||||
$this->getLeft()->applyFromArray($pStyles['left']);
|
$this->getLeft()->applyFromArray($pStyles['left']);
|
||||||
@@ -470,7 +471,7 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('diagonaldirection' => $pValue));
|
$styleArray = $this->getStyleArray(array('diagonaldirection' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_diagonalDirection = $pValue;
|
$this->_diagonalDirection = $pValue;
|
||||||
}
|
}
|
||||||
@@ -497,37 +498,6 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Style_Color implements PHPExcel_IComparable
|
class PHPExcel_Style_Color implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -171,9 +171,9 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXSelectedCells()
|
public function getSelectedCells()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXSelectedCells();
|
return $this->getActiveSheet()->getSelectedCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -182,9 +182,9 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXActiveCell()
|
public function getActiveCell()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXActiveCell();
|
return $this->getActiveSheet()->getActiveCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -226,7 +226,7 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable
|
|||||||
public function applyFromArray($pStyles = null) {
|
public function applyFromArray($pStyles = null) {
|
||||||
if (is_array($pStyles)) {
|
if (is_array($pStyles)) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||||
} else {
|
} else {
|
||||||
if (array_key_exists('rgb', $pStyles)) {
|
if (array_key_exists('rgb', $pStyles)) {
|
||||||
$this->setRGB($pStyles['rgb']);
|
$this->setRGB($pStyles['rgb']);
|
||||||
@@ -265,7 +265,7 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('argb' => $pValue));
|
$styleArray = $this->getStyleArray(array('argb' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_argb = $pValue;
|
$this->_argb = $pValue;
|
||||||
}
|
}
|
||||||
@@ -296,7 +296,7 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('argb' => 'FF' . $pValue));
|
$styleArray = $this->getStyleArray(array('argb' => 'FF' . $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_argb = 'FF' . $pValue;
|
$this->_argb = 'FF' . $pValue;
|
||||||
}
|
}
|
||||||
@@ -404,37 +404,6 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -276,37 +276,6 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Style_Fill implements PHPExcel_IComparable
|
class PHPExcel_Style_Fill implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -192,9 +192,9 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXSelectedCells()
|
public function getSelectedCells()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXSelectedCells();
|
return $this->getActiveSheet()->getSelectedCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -203,9 +203,9 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXActiveCell()
|
public function getActiveCell()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXActiveCell();
|
return $this->getActiveSheet()->getActiveCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -244,7 +244,7 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
|
|||||||
public function applyFromArray($pStyles = null) {
|
public function applyFromArray($pStyles = null) {
|
||||||
if (is_array($pStyles)) {
|
if (is_array($pStyles)) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||||
} else {
|
} else {
|
||||||
if (array_key_exists('type', $pStyles)) {
|
if (array_key_exists('type', $pStyles)) {
|
||||||
$this->setFillType($pStyles['type']);
|
$this->setFillType($pStyles['type']);
|
||||||
@@ -289,7 +289,7 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
|
|||||||
public function setFillType($pValue = PHPExcel_Style_Fill::FILL_NONE) {
|
public function setFillType($pValue = PHPExcel_Style_Fill::FILL_NONE) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('type' => $pValue));
|
$styleArray = $this->getStyleArray(array('type' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_fillType = $pValue;
|
$this->_fillType = $pValue;
|
||||||
}
|
}
|
||||||
@@ -317,7 +317,7 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
|
|||||||
public function setRotation($pValue = 0) {
|
public function setRotation($pValue = 0) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('rotation' => $pValue));
|
$styleArray = $this->getStyleArray(array('rotation' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_rotation = $pValue;
|
$this->_rotation = $pValue;
|
||||||
}
|
}
|
||||||
@@ -346,7 +346,7 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
|
|||||||
|
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStartColor()->getStyleArray(array('argb' => $color->getARGB()));
|
$styleArray = $this->getStartColor()->getStyleArray(array('argb' => $color->getARGB()));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_startColor = $color;
|
$this->_startColor = $color;
|
||||||
}
|
}
|
||||||
@@ -375,7 +375,7 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
|
|||||||
|
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getEndColor()->getStyleArray(array('argb' => $color->getARGB()));
|
$styleArray = $this->getEndColor()->getStyleArray(array('argb' => $color->getARGB()));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_endColor = $color;
|
$this->_endColor = $color;
|
||||||
}
|
}
|
||||||
@@ -400,37 +400,6 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Style_Font implements PHPExcel_IComparable
|
class PHPExcel_Style_Font implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -207,9 +207,9 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXSelectedCells()
|
public function getSelectedCells()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXSelectedCells();
|
return $this->getActiveSheet()->getSelectedCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,9 +218,9 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXActiveCell()
|
public function getActiveCell()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXActiveCell();
|
return $this->getActiveSheet()->getActiveCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -259,7 +259,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
|||||||
public function applyFromArray($pStyles = null) {
|
public function applyFromArray($pStyles = null) {
|
||||||
if (is_array($pStyles)) {
|
if (is_array($pStyles)) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||||
} else {
|
} else {
|
||||||
if (array_key_exists('name', $pStyles)) {
|
if (array_key_exists('name', $pStyles)) {
|
||||||
$this->setName($pStyles['name']);
|
$this->setName($pStyles['name']);
|
||||||
@@ -319,7 +319,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('name' => $pValue));
|
$styleArray = $this->getStyleArray(array('name' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_name = $pValue;
|
$this->_name = $pValue;
|
||||||
}
|
}
|
||||||
@@ -350,7 +350,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('size' => $pValue));
|
$styleArray = $this->getStyleArray(array('size' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_size = $pValue;
|
$this->_size = $pValue;
|
||||||
}
|
}
|
||||||
@@ -381,7 +381,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('bold' => $pValue));
|
$styleArray = $this->getStyleArray(array('bold' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_bold = $pValue;
|
$this->_bold = $pValue;
|
||||||
}
|
}
|
||||||
@@ -412,7 +412,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('italic' => $pValue));
|
$styleArray = $this->getStyleArray(array('italic' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_italic = $pValue;
|
$this->_italic = $pValue;
|
||||||
}
|
}
|
||||||
@@ -443,7 +443,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('superScript' => $pValue));
|
$styleArray = $this->getStyleArray(array('superScript' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_superScript = $pValue;
|
$this->_superScript = $pValue;
|
||||||
$this->_subScript = !$pValue;
|
$this->_subScript = !$pValue;
|
||||||
@@ -475,7 +475,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('subScript' => $pValue));
|
$styleArray = $this->getStyleArray(array('subScript' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_subScript = $pValue;
|
$this->_subScript = $pValue;
|
||||||
$this->_superScript = !$pValue;
|
$this->_superScript = !$pValue;
|
||||||
@@ -507,7 +507,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('underline' => $pValue));
|
$styleArray = $this->getStyleArray(array('underline' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_underline = $pValue;
|
$this->_underline = $pValue;
|
||||||
}
|
}
|
||||||
@@ -559,7 +559,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('strike' => $pValue));
|
$styleArray = $this->getStyleArray(array('strike' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_strikethrough = $pValue;
|
$this->_strikethrough = $pValue;
|
||||||
}
|
}
|
||||||
@@ -588,7 +588,7 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
|||||||
|
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getColor()->getStyleArray(array('argb' => $color->getARGB()));
|
$styleArray = $this->getColor()->getStyleArray(array('argb' => $color->getARGB()));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_color = $color;
|
$this->_color = $color;
|
||||||
}
|
}
|
||||||
@@ -618,37 +618,6 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation/Functions.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -203,9 +203,9 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXSelectedCells()
|
public function getSelectedCells()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXSelectedCells();
|
return $this->getActiveSheet()->getSelectedCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -214,9 +214,9 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXActiveCell()
|
public function getActiveCell()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXActiveCell();
|
return $this->getActiveSheet()->getActiveCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -248,7 +248,7 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
|||||||
public function applyFromArray($pStyles = null) {
|
public function applyFromArray($pStyles = null) {
|
||||||
if (is_array($pStyles)) {
|
if (is_array($pStyles)) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||||
} else {
|
} else {
|
||||||
if (array_key_exists('code', $pStyles)) {
|
if (array_key_exists('code', $pStyles)) {
|
||||||
$this->setFormatCode($pStyles['code']);
|
$this->setFormatCode($pStyles['code']);
|
||||||
@@ -288,7 +288,7 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('code' => $pValue));
|
$styleArray = $this->getStyleArray(array('code' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_formatCode = $pValue;
|
$this->_formatCode = $pValue;
|
||||||
$this->_builtInFormatCode = self::builtInFormatCodeIndex($pValue);
|
$this->_builtInFormatCode = self::builtInFormatCodeIndex($pValue);
|
||||||
@@ -318,7 +318,7 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
|||||||
|
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('code' => self::builtInFormatCode($pValue)));
|
$styleArray = $this->getStyleArray(array('code' => self::builtInFormatCode($pValue)));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_builtInFormatCode = $pValue;
|
$this->_builtInFormatCode = $pValue;
|
||||||
$this->_formatCode = self::builtInFormatCode($pValue);
|
$this->_formatCode = self::builtInFormatCode($pValue);
|
||||||
@@ -446,37 +446,6 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
@@ -491,15 +460,59 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static $_dateFormatReplacements = array(
|
||||||
|
// first remove escapes related to non-format characters
|
||||||
|
'\\' => '',
|
||||||
|
// 12-hour suffix
|
||||||
|
'am/pm' => 'A',
|
||||||
|
// 4-digit year
|
||||||
|
'yyyy' => 'Y',
|
||||||
|
// 2-digit year
|
||||||
|
'yy' => 'y',
|
||||||
|
// first letter of month - no php equivalent
|
||||||
|
'mmmmm' => 'M',
|
||||||
|
// full month name
|
||||||
|
'mmmm' => 'F',
|
||||||
|
// short month name
|
||||||
|
'mmm' => 'M',
|
||||||
|
// mm is minutes if time or month w/leading zero
|
||||||
|
':mm' => ':i',
|
||||||
|
// month leading zero
|
||||||
|
'mm' => 'm',
|
||||||
|
// month no leading zero
|
||||||
|
'm' => 'n',
|
||||||
|
// full day of week name
|
||||||
|
'dddd' => 'l',
|
||||||
|
// short day of week name
|
||||||
|
'ddd' => 'D',
|
||||||
|
// days leading zero
|
||||||
|
'dd' => 'd',
|
||||||
|
// days no leading zero
|
||||||
|
'd' => 'j',
|
||||||
|
// seconds
|
||||||
|
'ss' => 's',
|
||||||
|
// fractional seconds - no php equivalent
|
||||||
|
'.s' => ''
|
||||||
|
);
|
||||||
|
private static $_dateFormatReplacements24 = array(
|
||||||
|
'hh' => 'H',
|
||||||
|
'h' => 'G'
|
||||||
|
);
|
||||||
|
private static $_dateFormatReplacements12 = array(
|
||||||
|
'hh' => 'h',
|
||||||
|
'h' => 'g'
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a value in a pre-defined format to a PHP string
|
* Convert a value in a pre-defined format to a PHP string
|
||||||
*
|
*
|
||||||
* @param mixed $value Value to format
|
* @param mixed $value Value to format
|
||||||
* @param string $format Format code
|
* @param string $format Format code
|
||||||
|
* @param array $callBack Callback function for additional formatting of string
|
||||||
* @return string Formatted string
|
* @return string Formatted string
|
||||||
*/
|
*/
|
||||||
public static function toFormattedString($value = '', $format = '') {
|
public static function toFormattedString($value = '', $format = '', $callBack = null) {
|
||||||
// For now we do not treat strings although part 4 of a format code affects strings
|
// For now we do not treat strings although section 4 of a format code affects strings
|
||||||
if (!is_numeric($value)) return $value;
|
if (!is_numeric($value)) return $value;
|
||||||
|
|
||||||
// For 'General' format code, we just pass the value although this is not entirely the way Excel does it,
|
// For 'General' format code, we just pass the value although this is not entirely the way Excel does it,
|
||||||
@@ -508,67 +521,78 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the parts, there can be up to four parts
|
// Get the sections, there can be up to four sections
|
||||||
$parts = explode(';', $format);
|
$sections = explode(';', $format);
|
||||||
|
|
||||||
// We should really fetch the relevant part depending on whether we have a positive number,
|
// Fetch the relevant section depending on whether number is positive, negative, or zero?
|
||||||
// negative number, zero, or text. But for now we just use first part
|
// Text not supported yet.
|
||||||
$format = $parts[0];
|
// Here is how the sections apply to various values in Excel:
|
||||||
|
// 1 section: [POSITIVE/NEGATIVE/ZERO/TEXT]
|
||||||
|
// 2 sections: [POSITIVE/ZERO/TEXT] [NEGATIVE]
|
||||||
|
// 3 sections: [POSITIVE/TEXT] [NEGATIVE] [ZERO]
|
||||||
|
// 4 sections: [POSITIVE] [NEGATIVE] [ZERO] [TEXT]
|
||||||
|
switch (count($sections)) {
|
||||||
|
case 1:
|
||||||
|
$format = $sections[0];
|
||||||
|
break;
|
||||||
|
|
||||||
if (preg_match("/^[hmsdy]/i", $format)) { // custom datetime format
|
case 2:
|
||||||
|
$format = ($value >= 0) ? $sections[0] : $sections[1];
|
||||||
|
$value = abs($value); // Use the absolute value
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
$format = ($value > 0) ?
|
||||||
|
$sections[0] : ( ($value < 0) ?
|
||||||
|
$sections[1] : $sections[2]);
|
||||||
|
$value = abs($value); // Use the absolute value
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
$format = ($value > 0) ?
|
||||||
|
$sections[0] : ( ($value < 0) ?
|
||||||
|
$sections[1] : $sections[2]);
|
||||||
|
$value = abs($value); // Use the absolute value
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// something is wrong, just use first section
|
||||||
|
$format = $sections[0];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save format with color information for later use below
|
||||||
|
$formatColor = $format;
|
||||||
|
|
||||||
|
// Strip color information
|
||||||
|
$color_regex = '/^\\[[a-zA-Z]+\\]/';
|
||||||
|
$format = preg_replace($color_regex, '', $format);
|
||||||
|
|
||||||
|
// Let's begin inspecting the format and converting the value to a formatted string
|
||||||
|
if (preg_match('/^(\[\$[A-Z]*-[0-9A-F]*\])*[hmsdy]/i', $format)) { // datetime format
|
||||||
// dvc: convert Excel formats to PHP date formats
|
// dvc: convert Excel formats to PHP date formats
|
||||||
// first remove escapes related to non-format characters
|
|
||||||
|
// strip off first part containing e.g. [$-F800] or [$USD-409]
|
||||||
|
// general syntax: [$<Currency string>-<language info>]
|
||||||
|
// language info is in hexadecimal
|
||||||
|
$format = preg_replace('/^(\[\$[A-Z]*-[0-9A-F]*\])/i', '', $format);
|
||||||
|
|
||||||
// OpenOffice.org uses upper-case number formats, e.g. 'YYYY', convert to lower-case
|
// OpenOffice.org uses upper-case number formats, e.g. 'YYYY', convert to lower-case
|
||||||
$format = strtolower($format);
|
$format = strtolower($format);
|
||||||
|
|
||||||
$format = str_replace('\\', '', $format);
|
$format = strtr($format,self::$_dateFormatReplacements);
|
||||||
|
if (!strpos($format,'A')) { // 24-hour time format
|
||||||
// 4-digit year
|
$format = strtr($format,self::$_dateFormatReplacements24);
|
||||||
$format = str_replace('yyyy', 'Y', $format);
|
} else { // 12-hour time format
|
||||||
// 2-digit year
|
$format = strtr($format,self::$_dateFormatReplacements12);
|
||||||
$format = str_replace('yy', 'y', $format);
|
|
||||||
// first letter of month - no php equivalent
|
|
||||||
$format = str_replace('mmmmm', 'M', $format);
|
|
||||||
// full month name
|
|
||||||
$format = str_replace('mmmm', 'F', $format);
|
|
||||||
// short month name
|
|
||||||
$format = str_replace('mmm', 'M', $format);
|
|
||||||
// mm is minutes if time or month w/leading zero
|
|
||||||
$format = str_replace(':mm', ':i', $format);
|
|
||||||
// tmp place holder
|
|
||||||
$format = str_replace('mm', 'x', $format);
|
|
||||||
// month no leading zero
|
|
||||||
$format = str_replace('m', 'n', $format);
|
|
||||||
// month leading zero
|
|
||||||
$format = str_replace('x', 'm', $format);
|
|
||||||
// 12-hour suffix
|
|
||||||
$format = str_replace('am/pm', 'A', $format);
|
|
||||||
// full day of week name
|
|
||||||
$format = str_replace('dddd', 'l', $format);
|
|
||||||
// short day of week name
|
|
||||||
$format = str_replace('ddd', 'D', $format);
|
|
||||||
// tmp place holder
|
|
||||||
$format = str_replace('dd', 'x', $format);
|
|
||||||
// days no leading zero
|
|
||||||
$format = str_replace('d', 'j', $format);
|
|
||||||
// days leading zero
|
|
||||||
$format = str_replace('x', 'd', $format);
|
|
||||||
// seconds
|
|
||||||
$format = str_replace('ss', 's', $format);
|
|
||||||
// fractional seconds - no php equivalent
|
|
||||||
$format = str_replace('.s', '', $format);
|
|
||||||
|
|
||||||
if (!strpos($format,'A')) { // 24-hour format
|
|
||||||
$format = str_replace('h', 'H', $format);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return gmdate($format, PHPExcel_Shared_Date::ExcelToPHP($value));
|
$value = gmdate($format, PHPExcel_Shared_Date::ExcelToPHP($value));
|
||||||
|
|
||||||
} else if (preg_match('/%$/', $format)) { // % number format
|
} else if (preg_match('/%$/', $format)) { // % number format
|
||||||
if ($format === self::FORMAT_PERCENTAGE) {
|
if ($format === self::FORMAT_PERCENTAGE) {
|
||||||
return round( (100 * $value), 0) . '%';
|
$value = round( (100 * $value), 0) . '%';
|
||||||
}
|
} else {
|
||||||
if (preg_match('/\.[#0]+/i', $format, $m)) {
|
if (preg_match('/\.[#0]+/i', $format, $m)) {
|
||||||
$s = substr($m[0], 0, 1) . (strlen($m[0]) - 1);
|
$s = substr($m[0], 0, 1) . (strlen($m[0]) - 1);
|
||||||
$format = str_replace($m[0], $s, $format);
|
$format = str_replace($m[0], $s, $format);
|
||||||
@@ -578,12 +602,13 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
$format = '%' . str_replace('%', 'f%%', $format);
|
$format = '%' . str_replace('%', 'f%%', $format);
|
||||||
|
|
||||||
return sprintf($format, 100 * $value);
|
$value = sprintf($format, 100 * $value);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (preg_match ("/^([0-9.,-]+)$/", $value)) {
|
if (preg_match ("/^([0-9.,-]+)$/", $value)) {
|
||||||
if ($format === self::FORMAT_CURRENCY_EUR_SIMPLE) {
|
if ($format === self::FORMAT_CURRENCY_EUR_SIMPLE) {
|
||||||
return 'EUR ' . sprintf('%1.2f', $value);
|
$value = 'EUR ' . sprintf('%1.2f', $value);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// In Excel formats, "_" is used to add spacing, which we can't do in HTML
|
// In Excel formats, "_" is used to add spacing, which we can't do in HTML
|
||||||
@@ -618,7 +643,8 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
|||||||
$adjustedDecimalPart = $decimalPart/$GCD;
|
$adjustedDecimalPart = $decimalPart/$GCD;
|
||||||
$adjustedDecimalDivisor = $decimalDivisor/$GCD;
|
$adjustedDecimalDivisor = $decimalDivisor/$GCD;
|
||||||
|
|
||||||
if (strpos($format,'0') !== false) {
|
if ((strpos($format,'0') !== false) || (substr($format,0,3) == '? ?')) {
|
||||||
|
if ($integerPart == 0) { $integerPart = ''; }
|
||||||
$value = "$sign$integerPart $adjustedDecimalPart/$adjustedDecimalDivisor";
|
$value = "$sign$integerPart $adjustedDecimalPart/$adjustedDecimalDivisor";
|
||||||
} else {
|
} else {
|
||||||
$adjustedDecimalPart += $integerPart * $adjustedDecimalDivisor;
|
$adjustedDecimalPart += $integerPart * $adjustedDecimalDivisor;
|
||||||
@@ -633,12 +659,13 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
|||||||
$dec = $matches[2];
|
$dec = $matches[2];
|
||||||
$right = $matches[3];
|
$right = $matches[3];
|
||||||
if ($useThousands) {
|
if ($useThousands) {
|
||||||
$localeconv = localeconv();
|
$value = number_format(
|
||||||
if (($localeconv['thousands_sep'] == '') || ($localeconv['decimal_point'] == '')) {
|
$value
|
||||||
$value = number_format($value, strlen($right), $localeconv['mon_decimal_point'], $localeconv['mon_thousands_sep']);
|
, strlen($right)
|
||||||
} else {
|
, PHPExcel_Shared_String::getDecimalSeparator()
|
||||||
$value = number_format($value, strlen($right), $localeconv['decimal_point'], $localeconv['thousands_sep']);
|
, PHPExcel_Shared_String::getThousandsSeparator()
|
||||||
}
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$sprintf_pattern = "%1." . strlen($right) . "f";
|
$sprintf_pattern = "%1." . strlen($right) . "f";
|
||||||
$value = sprintf($sprintf_pattern, $value);
|
$value = sprintf($sprintf_pattern, $value);
|
||||||
@@ -646,13 +673,16 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
|||||||
$value = preg_replace($number_regex, $value, $format);
|
$value = preg_replace($number_regex, $value, $format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Additional formatting provided by callback function
|
||||||
|
if ($callBack !== null) {
|
||||||
|
list($writerInstance, $function) = $callBack;
|
||||||
|
$value = $writerInstance->$function($value, $formatColor);
|
||||||
|
}
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.4.5, 2007-08-23
|
* @version 1.4.5, 2007-08-23
|
||||||
*/
|
*/
|
||||||
@@ -43,7 +43,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/IComparable.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Style
|
* @package PHPExcel_Style
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Style_Protection implements PHPExcel_IComparable
|
class PHPExcel_Style_Protection implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -149,9 +149,9 @@ class PHPExcel_Style_Protection implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXSelectedCells()
|
public function getSelectedCells()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXSelectedCells();
|
return $this->getActiveSheet()->getSelectedCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -160,9 +160,9 @@ class PHPExcel_Style_Protection implements PHPExcel_IComparable
|
|||||||
*
|
*
|
||||||
* @return string E.g. 'A1'
|
* @return string E.g. 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXActiveCell()
|
public function getActiveCell()
|
||||||
{
|
{
|
||||||
return $this->getActiveSheet()->getXActiveCell();
|
return $this->getActiveSheet()->getActiveCell();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -190,7 +190,7 @@ class PHPExcel_Style_Protection implements PHPExcel_IComparable
|
|||||||
public function applyFromArray($pStyles = null) {
|
public function applyFromArray($pStyles = null) {
|
||||||
if (is_array($pStyles)) {
|
if (is_array($pStyles)) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
|
||||||
} else {
|
} else {
|
||||||
if (array_key_exists('locked', $pStyles)) {
|
if (array_key_exists('locked', $pStyles)) {
|
||||||
$this->setLocked($pStyles['locked']);
|
$this->setLocked($pStyles['locked']);
|
||||||
@@ -226,7 +226,7 @@ class PHPExcel_Style_Protection implements PHPExcel_IComparable
|
|||||||
public function setLocked($pValue = self::PROTECTION_INHERIT) {
|
public function setLocked($pValue = self::PROTECTION_INHERIT) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('locked' => $pValue));
|
$styleArray = $this->getStyleArray(array('locked' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_locked = $pValue;
|
$this->_locked = $pValue;
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ class PHPExcel_Style_Protection implements PHPExcel_IComparable
|
|||||||
public function setHidden($pValue = self::PROTECTION_INHERIT) {
|
public function setHidden($pValue = self::PROTECTION_INHERIT) {
|
||||||
if ($this->_isSupervisor) {
|
if ($this->_isSupervisor) {
|
||||||
$styleArray = $this->getStyleArray(array('hidden' => $pValue));
|
$styleArray = $this->getStyleArray(array('hidden' => $pValue));
|
||||||
$this->getActiveSheet()->getStyle($this->getXSelectedCells())->applyFromArray($styleArray);
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
} else {
|
} else {
|
||||||
$this->_hidden = $pValue;
|
$this->_hidden = $pValue;
|
||||||
}
|
}
|
||||||
@@ -277,37 +277,6 @@ class PHPExcel_Style_Protection implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -88,6 +88,9 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Style.php';
|
|||||||
/** PHPExcel_Style_Fill */
|
/** PHPExcel_Style_Fill */
|
||||||
require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Fill.php';
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Fill.php';
|
||||||
|
|
||||||
|
/** PHPExcel_Style_Color */
|
||||||
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Color.php';
|
||||||
|
|
||||||
/** PHPExcel_Style_NumberFormat */
|
/** PHPExcel_Style_NumberFormat */
|
||||||
require_once PHPEXCEL_ROOT . 'PHPExcel/Style/NumberFormat.php';
|
require_once PHPEXCEL_ROOT . 'PHPExcel/Style/NumberFormat.php';
|
||||||
|
|
||||||
@@ -112,7 +115,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/ReferenceHelper.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet implements PHPExcel_IComparable
|
class PHPExcel_Worksheet implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -121,6 +124,11 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
const BREAK_ROW = 1;
|
const BREAK_ROW = 1;
|
||||||
const BREAK_COLUMN = 2;
|
const BREAK_COLUMN = 2;
|
||||||
|
|
||||||
|
/* Sheet state */
|
||||||
|
const SHEETSTATE_VISIBLE = 'visible';
|
||||||
|
const SHEETSTATE_HIDDEN = 'hidden';
|
||||||
|
const SHEETSTATE_VERYHIDDEN = 'veryHidden';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parent spreadsheet
|
* Parent spreadsheet
|
||||||
*
|
*
|
||||||
@@ -177,6 +185,13 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
*/
|
*/
|
||||||
private $_title;
|
private $_title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sheet state
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private $_sheetState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page setup
|
* Page setup
|
||||||
*
|
*
|
||||||
@@ -304,39 +319,32 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
private $_comments = array();
|
private $_comments = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selected cell
|
* Active cell. (Only one!)
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_selectedCell = 'A1';
|
private $_activeCell = 'A1';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary property used by style supervisor. Will be removed
|
* Selected cells
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_xActiveCell = 'A1';
|
private $_selectedCells = 'A1';
|
||||||
|
|
||||||
/**
|
|
||||||
* Temporary property used by style supervisor. Will be removed
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_xSelectedCells = 'A1:A1';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cached highest column
|
* Cached highest column
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_cachedHighestColumn = null;
|
private $_cachedHighestColumn = 'A';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cached highest row
|
* Cached highest row
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
private $_cachedHighestRow = null;
|
private $_cachedHighestRow = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Right-to-left?
|
* Right-to-left?
|
||||||
@@ -359,6 +367,13 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
*/
|
*/
|
||||||
private $_dataValidationCollection = array();
|
private $_dataValidationCollection = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tab color
|
||||||
|
*
|
||||||
|
* @var PHPExcel_Style_Color
|
||||||
|
*/
|
||||||
|
private $_tabColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new worksheet
|
* Create a new worksheet
|
||||||
*
|
*
|
||||||
@@ -370,6 +385,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
// Set parent and title
|
// Set parent and title
|
||||||
$this->_parent = $pParent;
|
$this->_parent = $pParent;
|
||||||
$this->setTitle($pTitle);
|
$this->setTitle($pTitle);
|
||||||
|
$this->setSheetState(PHPExcel_Worksheet::SHEETSTATE_VISIBLE);
|
||||||
|
|
||||||
// Set page setup
|
// Set page setup
|
||||||
$this->_pageSetup = new PHPExcel_Worksheet_PageSetup();
|
$this->_pageSetup = new PHPExcel_Worksheet_PageSetup();
|
||||||
@@ -404,6 +420,28 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
$this->_defaultColumnDimension = new PHPExcel_Worksheet_ColumnDimension(null);
|
$this->_defaultColumnDimension = new PHPExcel_Worksheet_ColumnDimension(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check sheet title for valid Excel syntax
|
||||||
|
*
|
||||||
|
* @param string $pValue The string to check
|
||||||
|
* @return string The valid string
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private static function _checkSheetTitle($pValue)
|
||||||
|
{
|
||||||
|
// Some of the printable ASCII characters are invalid: * : / \ ? [ ]
|
||||||
|
if (preg_match('/(\\*|\\:|\\/|\\\\|\\?|\\[|\\])/', $pValue)) {
|
||||||
|
throw new Exception('Invalid character found in sheet title');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Maximum 31 characters allowed for sheet title
|
||||||
|
if (PHPExcel_Shared_String::CountCharacters($pValue) > 31) {
|
||||||
|
throw new Exception('Maximum 31 characters allowed in sheet title.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $pValue;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get collection of cells
|
* Get collection of cells
|
||||||
*
|
*
|
||||||
@@ -563,6 +601,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
*/
|
*/
|
||||||
public function calculateColumnWidths($calculateMergeCells = false)
|
public function calculateColumnWidths($calculateMergeCells = false)
|
||||||
{
|
{
|
||||||
|
// initialize $autoSizes array
|
||||||
$autoSizes = array();
|
$autoSizes = array();
|
||||||
foreach ($this->getColumnDimensions() as $colDimension) {
|
foreach ($this->getColumnDimensions() as $colDimension) {
|
||||||
if ($colDimension->getAutoSize()) {
|
if ($colDimension->getAutoSize()) {
|
||||||
@@ -570,10 +609,17 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->getCellCollection() as $cell) {
|
// There is only something to do if there are some auto-size columns
|
||||||
|
if (count($autoSizes) > 0) {
|
||||||
|
// loop though all cells in sheet expand $autoSizes
|
||||||
|
foreach ($this->getCellCollection(false) as $cell) {
|
||||||
if (isset($autoSizes[$cell->getColumn()])) {
|
if (isset($autoSizes[$cell->getColumn()])) {
|
||||||
|
// Calculated value
|
||||||
$cellValue = $cell->getCalculatedValue();
|
$cellValue = $cell->getCalculatedValue();
|
||||||
|
|
||||||
|
// To formatted string
|
||||||
|
$cellValue = PHPExcel_Style_NumberFormat::toFormattedString($cellValue, $this->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode());
|
||||||
|
|
||||||
foreach ($this->getMergeCells() as $cells) {
|
foreach ($this->getMergeCells() as $cells) {
|
||||||
if ($cell->isInRange($cells) && !$calculateMergeCells) {
|
if ($cell->isInRange($cells) && !$calculateMergeCells) {
|
||||||
$cellValue = ''; // do not calculate merge cells
|
$cellValue = ''; // do not calculate merge cells
|
||||||
@@ -583,18 +629,21 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
$autoSizes[$cell->getColumn()] = max(
|
$autoSizes[$cell->getColumn()] = max(
|
||||||
(float)$autoSizes[$cell->getColumn()],
|
(float)$autoSizes[$cell->getColumn()],
|
||||||
(float)PHPExcel_Shared_Font::calculateColumnWidth(
|
(float)PHPExcel_Shared_Font::calculateColumnWidth(
|
||||||
$this->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont()->getSize(),
|
$this->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont(),
|
||||||
false,
|
|
||||||
$cellValue,
|
$cellValue,
|
||||||
$this->getParent()->getCellXfByIndex($cell->getXfIndex())->getAlignment()->getTextRotation()
|
$this->getParent()->getCellXfByIndex($cell->getXfIndex())->getAlignment()->getTextRotation(),
|
||||||
|
$this->getDefaultStyle()->getFont()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -642,7 +691,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
* Set title
|
* Set title
|
||||||
*
|
*
|
||||||
* @param string $pValue String containing the dimension of this worksheet
|
* @param string $pValue String containing the dimension of this worksheet
|
||||||
* @throws Exception
|
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setTitle($pValue = 'Worksheet')
|
public function setTitle($pValue = 'Worksheet')
|
||||||
@@ -652,10 +700,8 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maximum 31 characters allowed for sheet title
|
// Syntax check
|
||||||
if (PHPExcel_Shared_String::CountCharacters($pValue) > 31) {
|
self::_checkSheetTitle($pValue);
|
||||||
throw new Exception('Maximum 31 characters allowed in sheet title.');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Old title
|
// Old title
|
||||||
$oldTitle = $this->getTitle();
|
$oldTitle = $this->getTitle();
|
||||||
@@ -685,6 +731,26 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get sheet state
|
||||||
|
*
|
||||||
|
* @return string Sheet state (visible, hidden, veryHidden)
|
||||||
|
*/
|
||||||
|
public function getSheetState() {
|
||||||
|
return $this->_sheetState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set sheet state
|
||||||
|
*
|
||||||
|
* @param string $value Sheet state (visible, hidden, veryHidden)
|
||||||
|
* @return PHPExcel_Worksheet
|
||||||
|
*/
|
||||||
|
public function setSheetState($value = PHPExcel_Worksheet::SHEETSTATE_VISIBLE) {
|
||||||
|
$this->_sheetState = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get page setup
|
* Get page setup
|
||||||
*
|
*
|
||||||
@@ -802,35 +868,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
*/
|
*/
|
||||||
public function getHighestColumn()
|
public function getHighestColumn()
|
||||||
{
|
{
|
||||||
// Cached?
|
|
||||||
if (!is_null($this->_cachedHighestColumn)) {
|
|
||||||
return $this->_cachedHighestColumn;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Highest column
|
|
||||||
$highestColumn = -1;
|
|
||||||
|
|
||||||
// Loop trough cells
|
|
||||||
foreach ($this->_cellCollection as $cell) {
|
|
||||||
if ($highestColumn < PHPExcel_Cell::columnIndexFromString($cell->getColumn())) {
|
|
||||||
$highestColumn = PHPExcel_Cell::columnIndexFromString($cell->getColumn());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loop trough column dimensions
|
|
||||||
foreach ($this->_columnDimensions as $dimension) {
|
|
||||||
if ($highestColumn < PHPExcel_Cell::columnIndexFromString($dimension->getColumnIndex())) {
|
|
||||||
$highestColumn = PHPExcel_Cell::columnIndexFromString($dimension->getColumnIndex());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return & cache
|
|
||||||
if ($highestColumn < 0) {
|
|
||||||
$this->_cachedHighestColumn = 'A';
|
|
||||||
} else {
|
|
||||||
$this->_cachedHighestColumn = PHPExcel_Cell::stringFromColumnIndex(--$highestColumn);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->_cachedHighestColumn;
|
return $this->_cachedHighestColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -841,35 +878,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
*/
|
*/
|
||||||
public function getHighestRow()
|
public function getHighestRow()
|
||||||
{
|
{
|
||||||
// Cached?
|
|
||||||
if (!is_null($this->_cachedHighestRow)) {
|
|
||||||
return $this->_cachedHighestRow;
|
return $this->_cachedHighestRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Highest row
|
|
||||||
$highestRow = 1;
|
|
||||||
|
|
||||||
// Loop trough cells
|
|
||||||
foreach ($this->_cellCollection as $cell) {
|
|
||||||
if ($cell->getRow() > $highestRow) {
|
|
||||||
$highestRow = $cell->getRow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loop trough row dimensions
|
|
||||||
foreach ($this->_rowDimensions as $dimension) {
|
|
||||||
if ($highestRow < $dimension->getRowIndex()) {
|
|
||||||
$highestRow = $dimension->getRowIndex();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cache
|
|
||||||
$this->_cachedHighestRow = $highestRow;
|
|
||||||
|
|
||||||
// Return
|
|
||||||
return $highestRow;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a cell value
|
* Set a cell value
|
||||||
*
|
*
|
||||||
@@ -949,7 +960,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
|
|
||||||
// Named range?
|
// Named range?
|
||||||
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_CELLREF.'$/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 (!is_null($namedRange)) {
|
if (!is_null($namedRange)) {
|
||||||
$pCoordinate = $namedRange->getRange();
|
$pCoordinate = $namedRange->getRange();
|
||||||
@@ -959,6 +970,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
} else {
|
} else {
|
||||||
throw new Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle());
|
throw new Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
//Allow named ranges within the same sheet.
|
||||||
|
return $this->getCell($pCoordinate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -971,14 +985,36 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
} elseif (strpos($pCoordinate,'$') !== false) {
|
} elseif (strpos($pCoordinate,'$') !== false) {
|
||||||
throw new Exception('Cell coordinate must not be absolute.');
|
throw new Exception('Cell coordinate must not be absolute.');
|
||||||
} else {
|
} else {
|
||||||
|
// Create new cell object
|
||||||
|
|
||||||
// Coordinates
|
// Coordinates
|
||||||
$aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate);
|
$aCoordinates = PHPExcel_Cell::coordinateFromString($pCoordinate);
|
||||||
|
|
||||||
$this->_cellCollection[$pCoordinate] = new PHPExcel_Cell($aCoordinates[0], $aCoordinates[1], null, PHPExcel_Cell_DataType::TYPE_NULL, $this);
|
$this->_cellCollection[$pCoordinate] = new PHPExcel_Cell($aCoordinates[0], $aCoordinates[1], null, PHPExcel_Cell_DataType::TYPE_NULL, $this);
|
||||||
$this->_cellCollectionIsSorted = false;
|
$this->_cellCollectionIsSorted = false;
|
||||||
|
|
||||||
$this->_cachedHighestColumn = null;
|
if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($aCoordinates[0]))
|
||||||
$this->_cachedHighestRow = null;
|
$this->_cachedHighestColumn = $aCoordinates[0];
|
||||||
|
|
||||||
|
if ($this->_cachedHighestRow < $aCoordinates[1])
|
||||||
|
$this->_cachedHighestRow = $aCoordinates[1];
|
||||||
|
|
||||||
|
// Cell needs appropriate xfIndex
|
||||||
|
$rowDimensions = $this->getRowDimensions();
|
||||||
|
$columnDimensions = $this->getColumnDimensions();
|
||||||
|
|
||||||
|
if ( isset($rowDimensions[$aCoordinates[1]]) && $rowDimensions[$aCoordinates[1]]->getXfIndex() !== null ) {
|
||||||
|
// then there is a row dimension with explicit style, assign it to the cell
|
||||||
|
$this->_cellCollection[$pCoordinate]->setXfIndex($rowDimensions[$aCoordinates[1]]->getXfIndex());
|
||||||
|
|
||||||
|
} else if ( isset($columnDimensions[$aCoordinates[0]]) ) {
|
||||||
|
// then there is a column dimension, assign it to the cell
|
||||||
|
$this->_cellCollection[$pCoordinate]->setXfIndex($columnDimensions[$aCoordinates[0]]->getXfIndex());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// set to default index
|
||||||
|
$this->_cellCollection[$pCoordinate]->setXfIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->_cellCollection[$pCoordinate];
|
return $this->_cellCollection[$pCoordinate];
|
||||||
}
|
}
|
||||||
@@ -1001,8 +1037,11 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
$this->_cellCollection[$coordinate] = new PHPExcel_Cell($columnLetter, $pRow, null, PHPExcel_Cell_DataType::TYPE_NULL, $this);
|
$this->_cellCollection[$coordinate] = new PHPExcel_Cell($columnLetter, $pRow, null, PHPExcel_Cell_DataType::TYPE_NULL, $this);
|
||||||
$this->_cellCollectionIsSorted = false;
|
$this->_cellCollectionIsSorted = false;
|
||||||
|
|
||||||
$this->_cachedHighestColumn = null;
|
if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < $pColumn)
|
||||||
$this->_cachedHighestRow = null;
|
$this->_cachedHighestColumn = $pColumn;
|
||||||
|
|
||||||
|
if ($this->_cachedHighestRow < $pRow)
|
||||||
|
$this->_cachedHighestRow = $pRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_cellCollection[$coordinate];
|
return $this->_cellCollection[$coordinate];
|
||||||
@@ -1025,7 +1064,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
|
|
||||||
// Named range?
|
// Named range?
|
||||||
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_CELLREF.'$/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 (!is_null($namedRange)) {
|
if (!is_null($namedRange)) {
|
||||||
$pCoordinate = $namedRange->getRange();
|
$pCoordinate = $namedRange->getRange();
|
||||||
@@ -1081,7 +1120,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
// Get row dimension
|
// Get row dimension
|
||||||
if (!isset($this->_rowDimensions[$pRow])) {
|
if (!isset($this->_rowDimensions[$pRow])) {
|
||||||
$this->_rowDimensions[$pRow] = new PHPExcel_Worksheet_RowDimension($pRow);
|
$this->_rowDimensions[$pRow] = new PHPExcel_Worksheet_RowDimension($pRow);
|
||||||
$this->_cachedHighestRow = null;
|
|
||||||
|
if ($this->_cachedHighestRow < $pRow)
|
||||||
|
$this->_cachedHighestRow = $pRow;
|
||||||
}
|
}
|
||||||
return $this->_rowDimensions[$pRow];
|
return $this->_rowDimensions[$pRow];
|
||||||
}
|
}
|
||||||
@@ -1100,7 +1141,9 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
// Fetch dimensions
|
// Fetch dimensions
|
||||||
if (!isset($this->_columnDimensions[$pColumn])) {
|
if (!isset($this->_columnDimensions[$pColumn])) {
|
||||||
$this->_columnDimensions[$pColumn] = new PHPExcel_Worksheet_ColumnDimension($pColumn);
|
$this->_columnDimensions[$pColumn] = new PHPExcel_Worksheet_ColumnDimension($pColumn);
|
||||||
$this->_cachedHighestColumn = null;
|
|
||||||
|
if (PHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < PHPExcel_Cell::columnIndexFromString($pColumn))
|
||||||
|
$this->_cachedHighestColumn = $pColumn;
|
||||||
}
|
}
|
||||||
return $this->_columnDimensions[$pColumn];
|
return $this->_columnDimensions[$pColumn];
|
||||||
}
|
}
|
||||||
@@ -1147,9 +1190,14 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setDefaultStyle(PHPExcel_Style $value)
|
public function setDefaultStyle(PHPExcel_Style $pValue)
|
||||||
{
|
{
|
||||||
$this->_parent->setDefaultStyle($value);
|
$this->_parent->getDefaultStyle()->applyFromArray(array(
|
||||||
|
'font' => array(
|
||||||
|
'name' => $pValue->getFont()->getName(),
|
||||||
|
'size' => $pValue->getFont()->getSize(),
|
||||||
|
),
|
||||||
|
));
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1166,7 +1214,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
$this->_parent->setActiveSheetIndex($this->_parent->getIndex($this));
|
$this->_parent->setActiveSheetIndex($this->_parent->getIndex($this));
|
||||||
|
|
||||||
// set cell coordinate as active
|
// set cell coordinate as active
|
||||||
$this->setXSelectedCells($pCellCoordinate);
|
$this->setSelectedCells($pCellCoordinate);
|
||||||
|
|
||||||
return $this->_parent->getCellXfSupervisor();
|
return $this->_parent->getCellXfSupervisor();
|
||||||
}
|
}
|
||||||
@@ -1317,7 +1365,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
$rangeEnd = $tmp;
|
$rangeEnd = $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop trough cells and apply styles
|
// Loop through cells and apply styles
|
||||||
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
|
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
|
||||||
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
|
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
|
||||||
$this->getCell(PHPExcel_Cell::stringFromColumnIndex($col) . $row)->setXfIndex($xfIndex);
|
$this->getCell(PHPExcel_Cell::stringFromColumnIndex($col) . $row)->setXfIndex($xfIndex);
|
||||||
@@ -1472,7 +1520,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get merge cells
|
* Get merge cells array.
|
||||||
*
|
*
|
||||||
* @return array[]
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
@@ -1481,6 +1529,19 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
return $this->_mergeCells;
|
return $this->_mergeCells;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set merge cells array for the entire sheet. Use instead mergeCells() to merge
|
||||||
|
* a single cell range.
|
||||||
|
*
|
||||||
|
* @param array
|
||||||
|
*/
|
||||||
|
public function setMergeCells($pValue = array())
|
||||||
|
{
|
||||||
|
$this->_mergeCells = $pValue;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set protection on a cell range
|
* Set protection on a cell range
|
||||||
*
|
*
|
||||||
@@ -1912,72 +1973,76 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
/**
|
/**
|
||||||
* Get selected cell
|
* Get selected cell
|
||||||
*
|
*
|
||||||
|
* @deprecated
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSelectedCell()
|
public function getSelectedCell()
|
||||||
{
|
{
|
||||||
return $this->_selectedCell;
|
return $this->getSelectedCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary method used by style supervisor. Will be removed
|
* Get active cell
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string Example: 'A1'
|
||||||
*/
|
*/
|
||||||
public function getXActiveCell()
|
public function getActiveCell()
|
||||||
{
|
{
|
||||||
return $this->_xActiveCell;
|
return $this->_activeCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary method used by style supervisor. Will be removed
|
* Get selected cells
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getXSelectedCells()
|
public function getSelectedCells()
|
||||||
{
|
{
|
||||||
return $this->_xSelectedCells;
|
return $this->_selectedCells;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selected cell
|
* Selected cell
|
||||||
*
|
*
|
||||||
* @param string $pCell Cell (i.e. A1)
|
* @param string $pCell Cell (i.e. A1)
|
||||||
* @throws Exception
|
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setSelectedCell($pCell = '')
|
public function setSelectedCell($pCoordinate = 'A1')
|
||||||
{
|
{
|
||||||
// Uppercase coordinate
|
return $this->setSelectedCells($pCoordinate);
|
||||||
$pCell = strtoupper($pCell);
|
|
||||||
|
|
||||||
if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) {
|
|
||||||
$this->_selectedCell = $pCell;
|
|
||||||
} else {
|
|
||||||
throw new Exception('Selected cell can not be set on a range of cells.');
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporary method used by style supervisor. Will be removed
|
* Select a range of cells.
|
||||||
*
|
*
|
||||||
* @param string $pCell Cell (i.e. A1)
|
* @param string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6'
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @return PHPExcel_Worksheet
|
* @return PHPExcel_Worksheet
|
||||||
*/
|
*/
|
||||||
public function setXSelectedCells($pCoordinate = 'A1:A1')
|
public function setSelectedCells($pCoordinate = 'A1')
|
||||||
{
|
{
|
||||||
// Uppercase coordinate
|
// Uppercase coordinate
|
||||||
$pCoordinate = strtoupper($pCoordinate);
|
$pCoordinate = strtoupper($pCoordinate);
|
||||||
|
|
||||||
|
// Convert 'A' to 'A:A'
|
||||||
|
$pCoordinate = preg_replace('/^([A-Z]+)$/', '${1}:${1}', $pCoordinate);
|
||||||
|
|
||||||
|
// Convert '1' to '1:1'
|
||||||
|
$pCoordinate = preg_replace('/^([0-9]+)$/', '${1}:${1}', $pCoordinate);
|
||||||
|
|
||||||
|
// Convert 'A:C' to 'A1:C1048576'
|
||||||
|
$pCoordinate = preg_replace('/^([A-Z]+):([A-Z]+)$/', '${1}1:${2}1048576', $pCoordinate);
|
||||||
|
|
||||||
|
// Convert '1:3' to 'A1:XFD3'
|
||||||
|
$pCoordinate = preg_replace('/^([0-9]+):([0-9]+)$/', 'A${1}:XFD${2}', $pCoordinate);
|
||||||
|
|
||||||
if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) {
|
if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) {
|
||||||
list($first, ) = PHPExcel_Cell::splitRange($pCoordinate);
|
list($first, ) = PHPExcel_Cell::splitRange($pCoordinate);
|
||||||
$this->_xActiveCell = $first[0];
|
$this->_activeCell = $first[0];
|
||||||
} else {
|
} else {
|
||||||
$this->_xActiveCell = $pCoordinate;
|
$this->_activeCell = $pCoordinate;
|
||||||
}
|
}
|
||||||
$this->_xSelectedCells = $pCoordinate;
|
$this->_selectedCells = $pCoordinate;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1991,7 +2056,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
*/
|
*/
|
||||||
public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 0)
|
public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 0)
|
||||||
{
|
{
|
||||||
return $this->setSelectedCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
|
return $this->setSelectedCells(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2028,7 +2093,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
list ($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($pCell);
|
list ($startColumn, $startRow) = PHPExcel_Cell::coordinateFromString($pCell);
|
||||||
$startColumn = PHPExcel_Cell::columnIndexFromString($startColumn) - 1;
|
$startColumn = PHPExcel_Cell::columnIndexFromString($startColumn) - 1;
|
||||||
|
|
||||||
// Loop trough $source
|
// Loop through $source
|
||||||
$currentRow = $startRow - 1;
|
$currentRow = $startRow - 1;
|
||||||
$rowData = null;
|
$rowData = null;
|
||||||
foreach ($source as $rowData) {
|
foreach ($source as $rowData) {
|
||||||
@@ -2071,7 +2136,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
$dimension[1] = PHPExcel_Cell::coordinateFromString($dimension[1]);
|
$dimension[1] = PHPExcel_Cell::coordinateFromString($dimension[1]);
|
||||||
$dimension[1][0] = PHPExcel_Cell::columnIndexFromString($dimension[1][0]) - 1;
|
$dimension[1][0] = PHPExcel_Cell::columnIndexFromString($dimension[1][0]) - 1;
|
||||||
|
|
||||||
// Loop trough cells
|
// Loop through cells
|
||||||
for ($row = $dimension[0][1]; $row <= $dimension[1][1]; ++$row) {
|
for ($row = $dimension[0][1]; $row <= $dimension[1][1]; ++$row) {
|
||||||
for ($column = $dimension[0][0]; $column <= $dimension[1][0]; ++$column) {
|
for ($column = $dimension[0][0]; $column <= $dimension[1][0]; ++$column) {
|
||||||
// Cell exists?
|
// Cell exists?
|
||||||
@@ -2125,6 +2190,10 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
$iterator->next();
|
$iterator->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lookup highest column and highest row if cells are cleaned
|
||||||
|
$highestColumn = -1;
|
||||||
|
$highestRow = 1;
|
||||||
|
|
||||||
// Find cells that can be cleaned
|
// Find cells that can be cleaned
|
||||||
foreach ($this->_cellCollection as $coordinate => $cell) {
|
foreach ($this->_cellCollection as $coordinate => $cell) {
|
||||||
// Can be cleaned?
|
// Can be cleaned?
|
||||||
@@ -2145,10 +2214,42 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
|
|
||||||
// Clean?
|
// Clean?
|
||||||
if ($canBeCleaned) {
|
if ($canBeCleaned) {
|
||||||
|
// Remove the cell
|
||||||
unset($this->_cellCollection[$coordinate]);
|
unset($this->_cellCollection[$coordinate]);
|
||||||
|
} else {
|
||||||
|
// Determine highest column and row
|
||||||
|
if ($highestColumn < PHPExcel_Cell::columnIndexFromString($cell->getColumn())) {
|
||||||
|
$highestColumn = PHPExcel_Cell::columnIndexFromString($cell->getColumn());
|
||||||
|
}
|
||||||
|
if ($cell->getRow() > $highestRow) {
|
||||||
|
$highestRow = $cell->getRow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Loop through column dimensions
|
||||||
|
foreach ($this->_columnDimensions as $dimension) {
|
||||||
|
if ($highestColumn < PHPExcel_Cell::columnIndexFromString($dimension->getColumnIndex())) {
|
||||||
|
$highestColumn = PHPExcel_Cell::columnIndexFromString($dimension->getColumnIndex());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop through row dimensions
|
||||||
|
foreach ($this->_rowDimensions as $dimension) {
|
||||||
|
if ($highestRow < $dimension->getRowIndex()) {
|
||||||
|
$highestRow = $dimension->getRowIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cache values
|
||||||
|
if ($highestColumn < 0) {
|
||||||
|
$this->_cachedHighestColumn = 'A';
|
||||||
|
} else {
|
||||||
|
$this->_cachedHighestColumn = PHPExcel_Cell::stringFromColumnIndex(--$highestColumn);
|
||||||
|
}
|
||||||
|
$this->_cachedHighestRow = $highestRow;
|
||||||
|
|
||||||
|
// Return
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2167,37 +2268,6 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract worksheet title from range.
|
* Extract worksheet title from range.
|
||||||
*
|
*
|
||||||
@@ -2350,6 +2420,42 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
return $this->_dataValidationCollection;
|
return $this->_dataValidationCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get tab color
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Style_Color
|
||||||
|
*/
|
||||||
|
public function getTabColor()
|
||||||
|
{
|
||||||
|
if (is_null($this->_tabColor))
|
||||||
|
$this->_tabColor = new PHPExcel_Style_Color();
|
||||||
|
|
||||||
|
return $this->_tabColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset tab color
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Worksheet
|
||||||
|
*/
|
||||||
|
public function resetTabColor()
|
||||||
|
{
|
||||||
|
$this->_tabColor = null;
|
||||||
|
unset($this->_tabColor);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tab color set?
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isTabColorSet()
|
||||||
|
{
|
||||||
|
return !is_null($this->_tabColor);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy worksheet (!= clone!)
|
* Copy worksheet (!= clone!)
|
||||||
*
|
*
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Drawing/Shadow.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -486,37 +486,6 @@ class PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_CellIterator extends IteratorIterator
|
class PHPExcel_Worksheet_CellIterator extends IteratorIterator
|
||||||
{
|
{
|
||||||
@@ -115,20 +115,7 @@ class PHPExcel_Worksheet_CellIterator extends IteratorIterator
|
|||||||
* @return PHPExcel_Cell
|
* @return PHPExcel_Cell
|
||||||
*/
|
*/
|
||||||
public function current() {
|
public function current() {
|
||||||
$cellExists = $this->_subject->cellExistsByColumnAndRow($this->_position, $this->_rowIndex);
|
|
||||||
if ( ($this->_onlyExistingCells && $cellExists) || (!$this->_onlyExistingCells) ) {
|
|
||||||
return $this->_subject->getCellByColumnAndRow($this->_position, $this->_rowIndex);
|
return $this->_subject->getCellByColumnAndRow($this->_position, $this->_rowIndex);
|
||||||
} else if ($this->_onlyExistingCells && !$cellExists) {
|
|
||||||
// Loop untill we find one
|
|
||||||
while ($this->valid()) {
|
|
||||||
$this->next();
|
|
||||||
if ($this->_subject->cellExistsByColumnAndRow($this->_position, $this->_rowIndex)) {
|
|
||||||
return $this->_subject->getCellByColumnAndRow($this->_position, $this->_rowIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,7 +140,23 @@ class PHPExcel_Worksheet_CellIterator extends IteratorIterator
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function valid() {
|
public function valid() {
|
||||||
return $this->_position < PHPExcel_Cell::columnIndexFromString( $this->_subject->getHighestColumn() );
|
// columnIndexFromString() returns an index based at one,
|
||||||
|
// treat it as a count when comparing it to the base zero
|
||||||
|
// position.
|
||||||
|
$columnCount = PHPExcel_Cell::columnIndexFromString($this->_subject->getHighestColumn());
|
||||||
|
|
||||||
|
if ($this->_onlyExistingCells) {
|
||||||
|
// If we aren't looking at an existing cell, either
|
||||||
|
// because the first column doesn't exist or next() has
|
||||||
|
// been called onto a nonexistent cell, then loop until we
|
||||||
|
// find one, or pass the last column.
|
||||||
|
while ($this->_position < $columnCount &&
|
||||||
|
!$this->_subject->cellExistsByColumnAndRow($this->_position, $this->_rowIndex)) {
|
||||||
|
++$this->_position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->_position < $columnCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_ColumnDimension
|
class PHPExcel_Worksheet_ColumnDimension
|
||||||
{
|
{
|
||||||
@@ -80,7 +80,14 @@ class PHPExcel_Worksheet_ColumnDimension
|
|||||||
private $_collapsed;
|
private $_collapsed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_RowDimension
|
* Index to cellXf
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $_xfIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Worksheet_ColumnDimension
|
||||||
*
|
*
|
||||||
* @param string $pIndex Character column index
|
* @param string $pIndex Character column index
|
||||||
*/
|
*/
|
||||||
@@ -93,6 +100,9 @@ class PHPExcel_Worksheet_ColumnDimension
|
|||||||
$this->_visible = true;
|
$this->_visible = true;
|
||||||
$this->_outlineLevel = 0;
|
$this->_outlineLevel = 0;
|
||||||
$this->_collapsed = false;
|
$this->_collapsed = false;
|
||||||
|
|
||||||
|
// set default index to cellXf
|
||||||
|
$this->_xfIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -222,6 +232,28 @@ class PHPExcel_Worksheet_ColumnDimension
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get index to cellXf
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getXfIndex()
|
||||||
|
{
|
||||||
|
return $this->_xfIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set index to cellXf
|
||||||
|
*
|
||||||
|
* @param int $pValue
|
||||||
|
* @return PHPExcel_Worksheet_ColumnDimension
|
||||||
|
*/
|
||||||
|
public function setXfIndex($pValue = 0)
|
||||||
|
{
|
||||||
|
$this->_xfIndex = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
@@ -235,4 +267,5 @@ class PHPExcel_Worksheet_ColumnDimension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet_Drawing
|
* @package PHPExcel_Worksheet_Drawing
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Drawing/Shadow.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet_Drawing
|
* @package PHPExcel_Worksheet_Drawing
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -153,37 +153,6 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet_Drawing
|
* @package PHPExcel_Worksheet_Drawing
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Style/Color.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet_Drawing
|
* @package PHPExcel_Worksheet_Drawing
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -289,37 +289,6 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/HeaderFooterDrawing.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_HeaderFooter
|
class PHPExcel_Worksheet_HeaderFooter
|
||||||
{
|
{
|
||||||
@@ -457,7 +457,7 @@ class PHPExcel_Worksheet_HeaderFooter
|
|||||||
/**
|
/**
|
||||||
* Get header/footer images
|
* Get header/footer images
|
||||||
*
|
*
|
||||||
* @return HPExcel_Worksheet_HeaderFooterDrawing[]
|
* @return PHPExcel_Worksheet_HeaderFooterDrawing[]
|
||||||
*/
|
*/
|
||||||
public function getImages() {
|
public function getImages() {
|
||||||
// Sort array
|
// Sort array
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Drawing.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing implements PHPExcel_IComparable
|
class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -354,37 +354,6 @@ class PHPExcel_Worksheet_HeaderFooterDrawing extends PHPExcel_Worksheet_Drawing
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Drawing/Shadow.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing implements PHPExcel_IComparable
|
||||||
{
|
{
|
||||||
@@ -205,37 +205,6 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Hash index
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $_hashIndex;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @return string Hash index
|
|
||||||
*/
|
|
||||||
public function getHashIndex() {
|
|
||||||
return $this->_hashIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set hash index
|
|
||||||
*
|
|
||||||
* Note that this index may vary during script execution! Only reliable moment is
|
|
||||||
* while doing a write of a workbook and when changes are not allowed.
|
|
||||||
*
|
|
||||||
* @param string $value Hash index
|
|
||||||
*/
|
|
||||||
public function setHashIndex($value) {
|
|
||||||
$this->_hashIndex = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_PageMargins
|
class PHPExcel_Worksheet_PageMargins
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_PageSetup
|
class PHPExcel_Worksheet_PageSetup
|
||||||
{
|
{
|
||||||
@@ -203,6 +203,14 @@ class PHPExcel_Worksheet_PageSetup
|
|||||||
*/
|
*/
|
||||||
private $_scale;
|
private $_scale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fit To Page
|
||||||
|
* Whether scale or fitToWith / fitToHeight applies
|
||||||
|
*
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_fitToPage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fit To Height
|
* Fit To Height
|
||||||
* Number of vertical pages to fit on
|
* Number of vertical pages to fit on
|
||||||
@@ -254,6 +262,13 @@ class PHPExcel_Worksheet_PageSetup
|
|||||||
*/
|
*/
|
||||||
private $_printArea = null;
|
private $_printArea = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* First page number
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
private $_firstPageNumber = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_PageSetup
|
* Create a new PHPExcel_Worksheet_PageSetup
|
||||||
*/
|
*/
|
||||||
@@ -262,14 +277,16 @@ class PHPExcel_Worksheet_PageSetup
|
|||||||
// Initialise values
|
// Initialise values
|
||||||
$this->_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
|
$this->_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
|
||||||
$this->_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
|
$this->_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
|
||||||
$this->_scale = null;
|
$this->_scale = 100;
|
||||||
$this->_fitToHeight = null;
|
$this->_fitToPage = false;
|
||||||
$this->_fitToWidth = null;
|
$this->_fitToHeight = 1;
|
||||||
|
$this->_fitToWidth = 1;
|
||||||
$this->_columnsToRepeatAtLeft = array('', '');
|
$this->_columnsToRepeatAtLeft = array('', '');
|
||||||
$this->_rowsToRepeatAtTop = array(0, 0);
|
$this->_rowsToRepeatAtTop = array(0, 0);
|
||||||
$this->_horizontalCentered = false;
|
$this->_horizontalCentered = false;
|
||||||
$this->_verticalCentered = false;
|
$this->_verticalCentered = false;
|
||||||
$this->_printArea = null;
|
$this->_printArea = null;
|
||||||
|
$this->_firstPageNumber = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -328,20 +345,44 @@ class PHPExcel_Worksheet_PageSetup
|
|||||||
* This setting is overridden when fitToWidth and/or fitToHeight are in use
|
* This setting is overridden when fitToWidth and/or fitToHeight are in use
|
||||||
*
|
*
|
||||||
* @param int? $pValue
|
* @param int? $pValue
|
||||||
|
* @param boolean $pUpdate Update fitToPage so scaling applies rather than fitToHeight / fitToWidth
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @return PHPExcel_Worksheet_PageSetup
|
* @return PHPExcel_Worksheet_PageSetup
|
||||||
*/
|
*/
|
||||||
public function setScale($pValue = 100) {
|
public function setScale($pValue = 100, $pUpdate = true) {
|
||||||
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
|
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
|
||||||
// but it is apparently still able to handle any scale >= 0, where 0 results in 100
|
// but it is apparently still able to handle any scale >= 0, where 0 results in 100
|
||||||
if (($pValue >= 0) || is_null($pValue)) {
|
if (($pValue >= 0) || is_null($pValue)) {
|
||||||
$this->_scale = $pValue;
|
$this->_scale = $pValue;
|
||||||
|
if ($pUpdate) {
|
||||||
|
$this->_fitToPage = false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Scale must not be negative");
|
throw new Exception("Scale must not be negative");
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Fit To Page
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function getFitToPage() {
|
||||||
|
return $this->_fitToPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Fit To Page
|
||||||
|
*
|
||||||
|
* @param boolean $pValue
|
||||||
|
* @return PHPExcel_Worksheet_PageSetup
|
||||||
|
*/
|
||||||
|
public function setFitToPage($pValue = true) {
|
||||||
|
$this->_fitToPage = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Fit To Height
|
* Get Fit To Height
|
||||||
*
|
*
|
||||||
@@ -355,11 +396,13 @@ class PHPExcel_Worksheet_PageSetup
|
|||||||
* Set Fit To Height
|
* Set Fit To Height
|
||||||
*
|
*
|
||||||
* @param int? $pValue
|
* @param int? $pValue
|
||||||
|
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling
|
||||||
* @return PHPExcel_Worksheet_PageSetup
|
* @return PHPExcel_Worksheet_PageSetup
|
||||||
*/
|
*/
|
||||||
public function setFitToHeight($pValue = 1) {
|
public function setFitToHeight($pValue = 1, $pUpdate = true) {
|
||||||
if ($pValue != '') {
|
|
||||||
$this->_fitToHeight = $pValue;
|
$this->_fitToHeight = $pValue;
|
||||||
|
if ($pUpdate) {
|
||||||
|
$this->_fitToPage = true;
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -377,11 +420,13 @@ class PHPExcel_Worksheet_PageSetup
|
|||||||
* Set Fit To Width
|
* Set Fit To Width
|
||||||
*
|
*
|
||||||
* @param int? $pValue
|
* @param int? $pValue
|
||||||
|
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling
|
||||||
* @return PHPExcel_Worksheet_PageSetup
|
* @return PHPExcel_Worksheet_PageSetup
|
||||||
*/
|
*/
|
||||||
public function setFitToWidth($pValue = 1) {
|
public function setFitToWidth($pValue = 1, $pUpdate = true) {
|
||||||
if ($pValue != '') {
|
|
||||||
$this->_fitToWidth = $pValue;
|
$this->_fitToWidth = $pValue;
|
||||||
|
if ($pUpdate) {
|
||||||
|
$this->_fitToPage = true;
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -543,7 +588,7 @@ class PHPExcel_Worksheet_PageSetup
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set print area
|
* Set print area. E.g. 'A1:D10' or 'A1:D10,G5:M20'
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@@ -574,6 +619,35 @@ class PHPExcel_Worksheet_PageSetup
|
|||||||
return $this->setPrintArea(PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2);
|
return $this->setPrintArea(PHPExcel_Cell::stringFromColumnIndex($column1) . $row1 . ':' . PHPExcel_Cell::stringFromColumnIndex($column2) . $row2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get first page number
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getFirstPageNumber() {
|
||||||
|
return $this->_firstPageNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set first page number
|
||||||
|
*
|
||||||
|
* @param int $value
|
||||||
|
* @return PHPExcel_Worksheet_HeaderFooter
|
||||||
|
*/
|
||||||
|
public function setFirstPageNumber($value = null) {
|
||||||
|
$this->_firstPageNumber = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset first page number
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Worksheet_HeaderFooter
|
||||||
|
*/
|
||||||
|
public function resetFirstPageNumber() {
|
||||||
|
return $this->setFirstPageNumber(null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/PasswordHasher.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_Protection
|
class PHPExcel_Worksheet_Protection
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/CellIterator.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_Row
|
class PHPExcel_Worksheet_Row
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_RowDimension
|
class PHPExcel_Worksheet_RowDimension
|
||||||
{
|
{
|
||||||
@@ -72,6 +72,13 @@ class PHPExcel_Worksheet_RowDimension
|
|||||||
*/
|
*/
|
||||||
private $_collapsed;
|
private $_collapsed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index to cellXf. Null value means row has no explicit cellXf format.
|
||||||
|
*
|
||||||
|
* @var int|null
|
||||||
|
*/
|
||||||
|
private $_xfIndex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Worksheet_RowDimension
|
* Create a new PHPExcel_Worksheet_RowDimension
|
||||||
*
|
*
|
||||||
@@ -85,6 +92,9 @@ class PHPExcel_Worksheet_RowDimension
|
|||||||
$this->_visible = true;
|
$this->_visible = true;
|
||||||
$this->_outlineLevel = 0;
|
$this->_outlineLevel = 0;
|
||||||
$this->_collapsed = false;
|
$this->_collapsed = false;
|
||||||
|
|
||||||
|
// set row dimension as unformatted by default
|
||||||
|
$this->_xfIndex = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -194,6 +204,28 @@ class PHPExcel_Worksheet_RowDimension
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get index to cellXf
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getXfIndex()
|
||||||
|
{
|
||||||
|
return $this->_xfIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set index to cellXf
|
||||||
|
*
|
||||||
|
* @param int $pValue
|
||||||
|
* @return PHPExcel_Worksheet_RowDimension
|
||||||
|
*/
|
||||||
|
public function setXfIndex($pValue = 0)
|
||||||
|
{
|
||||||
|
$this->_xfIndex = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/Row.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_RowIterator extends IteratorIterator
|
class PHPExcel_Worksheet_RowIterator extends IteratorIterator
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Worksheet
|
* @package PHPExcel_Worksheet
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Worksheet_SheetView
|
class PHPExcel_Worksheet_SheetView
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel
|
* @package PHPExcel
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_WorksheetIterator extends IteratorIterator
|
class PHPExcel_WorksheetIterator extends IteratorIterator
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer
|
* @package PHPExcel_Writer
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/String.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer
|
* @package PHPExcel_Writer
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter {
|
class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter {
|
||||||
/**
|
/**
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_Excel2007
|
* @package PHPExcel_Writer_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Writer/Excel2007/Comments.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_Excel2007
|
* @package PHPExcel_Writer_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
|
class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_Excel2007
|
* @package PHPExcel_Writer_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_Excel2007
|
* @package PHPExcel_Writer_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_WriterPart
|
class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_WriterPart
|
||||||
{
|
{
|
||||||
@@ -107,14 +107,14 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
|
|||||||
$objWriter->startElement('comments');
|
$objWriter->startElement('comments');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
|
||||||
|
|
||||||
// Loop trough authors
|
// Loop through authors
|
||||||
$objWriter->startElement('authors');
|
$objWriter->startElement('authors');
|
||||||
foreach ($authors as $author => $index) {
|
foreach ($authors as $author => $index) {
|
||||||
$objWriter->writeElement('author', $author);
|
$objWriter->writeElement('author', $author);
|
||||||
}
|
}
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
// Loop trough comments
|
// Loop through comments
|
||||||
$objWriter->startElement('commentList');
|
$objWriter->startElement('commentList');
|
||||||
foreach ($comments as $key => $value) {
|
foreach ($comments as $key => $value) {
|
||||||
$this->_writeComment($objWriter, $key, $value, $authors);
|
$this->_writeComment($objWriter, $key, $value, $authors);
|
||||||
@@ -212,7 +212,7 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
|
|||||||
|
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
// Loop trough comments
|
// Loop through comments
|
||||||
foreach ($comments as $key => $value) {
|
foreach ($comments as $key => $value) {
|
||||||
$this->_writeVMLComment($objWriter, $key, $value);
|
$this->_writeVMLComment($objWriter, $key, $value);
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_Excel2007
|
* @package PHPExcel_Writer_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_Excel2007
|
* @package PHPExcel_Writer_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_WriterPart
|
class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_WriterPart
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_Excel2007
|
* @package PHPExcel_Writer_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_Excel2007
|
* @package PHPExcel_Writer_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_WriterPart
|
class PHPExcel_Writer_Excel2007_DocProps extends PHPExcel_Writer_Excel2007_WriterPart
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_Excel2007
|
* @package PHPExcel_Writer_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_Excel2007
|
* @package PHPExcel_Writer_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_WriterPart
|
class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_WriterPart
|
||||||
{
|
{
|
||||||
@@ -99,7 +99,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
|||||||
$objWriter->writeAttribute('xmlns:xdr', 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing');
|
$objWriter->writeAttribute('xmlns:xdr', 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing');
|
||||||
$objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
|
$objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
|
||||||
|
|
||||||
// Loop trough images and write drawings
|
// Loop through images and write drawings
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$iterator = $pWorksheet->getDrawingCollection()->getIterator();
|
$iterator = $pWorksheet->getDrawingCollection()->getIterator();
|
||||||
while ($iterator->valid()) {
|
while ($iterator->valid()) {
|
||||||
@@ -469,7 +469,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
|||||||
|
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
// Loop trough images
|
// Loop through images
|
||||||
foreach ($images as $key => $value) {
|
foreach ($images as $key => $value) {
|
||||||
$this->_writeVMLHeaderFooterImage($objWriter, $key, $value);
|
$this->_writeVMLHeaderFooterImage($objWriter, $key, $value);
|
||||||
}
|
}
|
||||||
@@ -535,10 +535,10 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
|
|||||||
// Get an array of all drawings
|
// Get an array of all drawings
|
||||||
$aDrawings = array();
|
$aDrawings = array();
|
||||||
|
|
||||||
// Loop trough PHPExcel
|
// Loop through PHPExcel
|
||||||
$sheetCount = $pPHPExcel->getSheetCount();
|
$sheetCount = $pPHPExcel->getSheetCount();
|
||||||
for ($i = 0; $i < $sheetCount; ++$i) {
|
for ($i = 0; $i < $sheetCount; ++$i) {
|
||||||
// Loop trough images and add to array
|
// Loop through images and add to array
|
||||||
$iterator = $pPHPExcel->getSheet($i)->getDrawingCollection()->getIterator();
|
$iterator = $pPHPExcel->getSheet($i)->getDrawingCollection()->getIterator();
|
||||||
while ($iterator->valid()) {
|
while ($iterator->valid()) {
|
||||||
$aDrawings[] = $iterator->current();
|
$aDrawings[] = $iterator->current();
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPExcel
|
* PHPExcel
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 - 2009 PHPExcel
|
* Copyright (c) 2006 - 2010 PHPExcel
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -20,9 +20,9 @@
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_Excel2007
|
* @package PHPExcel_Writer_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 1.7.0, 2009-08-10
|
* @version 1.7.2, 2010-01-11
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/XMLWriter.php';
|
|||||||
*
|
*
|
||||||
* @category PHPExcel
|
* @category PHPExcel
|
||||||
* @package PHPExcel_Writer_Excel2007
|
* @package PHPExcel_Writer_Excel2007
|
||||||
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
|
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPart
|
class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPart
|
||||||
{
|
{
|
||||||
@@ -219,13 +219,13 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
|||||||
|
|
||||||
// Write hyperlink relationships?
|
// Write hyperlink relationships?
|
||||||
$i = 1;
|
$i = 1;
|
||||||
foreach ($pWorksheet->getCellCollection() as $cell) {
|
foreach ($pWorksheet->getHyperlinkCollection() as $hyperlink) {
|
||||||
if ($cell->hasHyperlink() && !$cell->getHyperlink()->isInternal()) {
|
if (!$hyperlink->isInternal()) {
|
||||||
$this->_writeRelationship(
|
$this->_writeRelationship(
|
||||||
$objWriter,
|
$objWriter,
|
||||||
'_hyperlink_' . $i,
|
'_hyperlink_' . $i,
|
||||||
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
|
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
|
||||||
$cell->getHyperlink()->getUrl(),
|
$hyperlink->getUrl(),
|
||||||
'External'
|
'External'
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
|||||||
$objWriter->startElement('Relationships');
|
$objWriter->startElement('Relationships');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
||||||
|
|
||||||
// Loop trough images and write relationships
|
// Loop through images and write relationships
|
||||||
$i = 1;
|
$i = 1;
|
||||||
$iterator = $pWorksheet->getDrawingCollection()->getIterator();
|
$iterator = $pWorksheet->getDrawingCollection()->getIterator();
|
||||||
while ($iterator->valid()) {
|
while ($iterator->valid()) {
|
||||||
@@ -341,7 +341,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
|
|||||||
$objWriter->startElement('Relationships');
|
$objWriter->startElement('Relationships');
|
||||||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
|
||||||
|
|
||||||
// Loop trough images and write relationships
|
// Loop through images and write relationships
|
||||||
foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) {
|
foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) {
|
||||||
// Write relationship for image drawing
|
// Write relationship for image drawing
|
||||||
$this->_writeRelationship(
|
$this->_writeRelationship(
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user