From 04c1608f3fc81cba01a02f4a6dd16462daaebb9f Mon Sep 17 00:00:00 2001 From: Mark Baker Date: Fri, 10 May 2013 14:21:23 +0100 Subject: [PATCH] Feature: Added getStyle() method to Cell object --- Classes/PHPExcel/Cell.php | 11 +++++++++++ Classes/PHPExcel/Worksheet.php | 8 ++++---- changelog.txt | 11 ++++++----- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Classes/PHPExcel/Cell.php b/Classes/PHPExcel/Cell.php index 310680c..9a52fc0 100644 --- a/Classes/PHPExcel/Cell.php +++ b/Classes/PHPExcel/Cell.php @@ -902,6 +902,17 @@ class PHPExcel_Cell self::$_valueBinder = $binder; } + /** + * Get style for cell + * + * @return PHPExcel_Style + * @throws PHPExcel_Exception + */ + public function getStyle() + { + return $this->getWorksheet()->getParent()->getCellXfByIndex($this->getXfIndex()); + } + /** * Implement PHP __clone to create a deep clone, not just a shallow copy. */ diff --git a/Classes/PHPExcel/Worksheet.php b/Classes/PHPExcel/Worksheet.php index 37df750..81717b6 100644 --- a/Classes/PHPExcel/Worksheet.php +++ b/Classes/PHPExcel/Worksheet.php @@ -36,13 +36,13 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable { /* Break types */ - const BREAK_NONE = 0; - const BREAK_ROW = 1; - const BREAK_COLUMN = 2; + const BREAK_NONE = 0; + const BREAK_ROW = 1; + const BREAK_COLUMN = 2; /* Sheet state */ const SHEETSTATE_VISIBLE = 'visible'; - const SHEETSTATE_HIDDEN = 'hidden'; + const SHEETSTATE_HIDDEN = 'hidden'; const SHEETSTATE_VERYHIDDEN = 'veryHidden'; /** diff --git a/changelog.txt b/changelog.txt index cfe1749..0e0c550 100644 --- a/changelog.txt +++ b/changelog.txt @@ -26,6 +26,7 @@ Fixed in develop branch for release v1.7.9: - Feature: (MBaker) Include charts option for HTML Writer - Feature: (MBaker) Added composer file +- Feature: (MBaker) Added getStyle() method to Cell object - Bugfix: (Asker) Work item 18777 - Error in PHPEXCEL/Calculation.php script on line 2976 (stack pop check) - Bugfix: (MBaker) Work item 18794 - CSV files without a file extension being identified as HTML - Bugfix: (AndreKR) Work item GH-66 - Wrong check for maximum number of rows in Excel5 Writer @@ -63,7 +64,7 @@ Fixed in develop branch for release v1.7.9: -------------------------------------------------------------------------------- BREAKING CHANGE! As part of the planned changes for handling array formulae in -workbooks, there are some changes that will affect the PHPExcel_Cell object +workbooks, there are some changes that will affect the PHPExcel_Cell object methods. The following methods are now deprecated, and will be removed in or after version 1.8.0: @@ -81,13 +82,13 @@ The following methods will be added in version 1.8.0 value if the cell doesn't contain a formula, or is not part of an array formula range. setFormula() Use to set a cell formula. It will still be possible - to set formulae using the setValue() and + to set formulae using the setValue() and setValueExplicit() methods. calculate() Use to execute a formula calculation to update the cell value. isFormula() Use to determine if a cell contains a formula, or is part of an array formula range or not. - isArrayFormula() Use to determine if a cell contains an array formula, + isArrayFormula() Use to determine if a cell contains an array formula, or is part of an array formula range or not. getArrayFormulaRange() Use to retrieve an array formula range. @@ -98,7 +99,7 @@ The following methods will be changed in version 1.8.0 setValueExplicit() The logic behind this will be modified to store formula values in the new cell property structure, but it will still perform the same function. - getValue() Will no longer return a formula if the cell contains + getValue() Will no longer return a formula if the cell contains a formula, but will return the calculated value instead. For cells that don't contain a formula, it will still return the stored value. @@ -178,7 +179,7 @@ The following methods will be changed in version 1.8.0 - General: (MBaker) Reduce cell caching overhead using dirty flag to ensure that cells are only rewritten to the cache if they have actually been changed - General: (MBaker) Improved memory usage in CSV Writer - General: (MBaker) Improved speed and memory usage in Excel5 Writer -- General: (MBaker) Experimental - +- General: (MBaker) Experimental - Added getHighestDataColumn(), getHighestDataRow(), getHighestRowAndColumn() and calculateWorksheetDataDimension() methods for the worksheet that return the highest row and column that have cell records - General: (MBaker) Change iterators to implement Iterator rather than extend CachingIterator, as a fix for PHP 5.4. changes in SPL - Bugfix: (MBaker) Work item 15459 - Invalid cell coordinate in Autofilter for Excel2007 Writer