mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-25 14:56:04 +03:00
General: (dresenhista) Work Item GH-242 - Functionality to getHighestRow() for a specified column, and getHighestColumn() for a specified row
This commit is contained in:
parent
2bbe908e77
commit
13a98ef631
@ -254,25 +254,54 @@ abstract class PHPExcel_CachedObjectStorage_CacheBase {
|
|||||||
/**
|
/**
|
||||||
* Get highest worksheet column
|
* Get highest worksheet column
|
||||||
*
|
*
|
||||||
|
* @param string $row Return the highest column for the specified row,
|
||||||
|
* or the highest column of any row if no row number is passed
|
||||||
* @return string Highest column name
|
* @return string Highest column name
|
||||||
*/
|
*/
|
||||||
public function getHighestColumn()
|
public function getHighestColumn($row = null)
|
||||||
{
|
{
|
||||||
|
if ($row == null) {
|
||||||
$colRow = $this->getHighestRowAndColumn();
|
$colRow = $this->getHighestRowAndColumn();
|
||||||
return $colRow['column'];
|
return $colRow['column'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$columnList = array(1);
|
||||||
|
foreach ($this->getCellList() as $coord) {
|
||||||
|
sscanf($coord,'%[A-Z]%d', $c, $r);
|
||||||
|
if ($r != $row) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$columnList[] = PHPExcel_Cell::columnIndexFromString($c);
|
||||||
|
}
|
||||||
|
return PHPExcel_Cell::stringFromColumnIndex(max($columnList) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get highest worksheet row
|
* Get highest worksheet row
|
||||||
*
|
*
|
||||||
|
* @param string $column Return the highest row for the specified column,
|
||||||
|
* or the highest row of any column if no column letter is passed
|
||||||
* @return int Highest row number
|
* @return int Highest row number
|
||||||
*/
|
*/
|
||||||
public function getHighestRow()
|
public function getHighestRow($column = null)
|
||||||
{
|
{
|
||||||
|
if ($column == null) {
|
||||||
$colRow = $this->getHighestRowAndColumn();
|
$colRow = $this->getHighestRowAndColumn();
|
||||||
return $colRow['row'];
|
return $colRow['row'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$rowList = array(0);
|
||||||
|
foreach ($this->getCellList() as $coord) {
|
||||||
|
sscanf($coord,'%[A-Z]%d', $c, $r);
|
||||||
|
if ($c != $column) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$rowList[] = $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
return max($rowList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a unique ID for cache referencing
|
* Generate a unique ID for cache referencing
|
||||||
|
@ -41,6 +41,7 @@ Fixed in develop branch for release v1.8.0:
|
|||||||
- General: (MBaker) - Fix to calculation properties for Excel2007 so that the opening application will only recalculate on load if it's actually required
|
- General: (MBaker) - Fix to calculation properties for Excel2007 so that the opening application will only recalculate on load if it's actually required
|
||||||
- General: (MBaker) - Modified Excel2007 Writer to default preCalculateFormulas to false
|
- General: (MBaker) - Modified Excel2007 Writer to default preCalculateFormulas to false
|
||||||
Note that autosize columns will still recalculate affected formulae internally
|
Note that autosize columns will still recalculate affected formulae internally
|
||||||
|
- General: (dresenhista) Work Item GH-242 - Functionality to getHighestRow() for a specified column, and getHighestColumn() for a specified row
|
||||||
|
|
||||||
|
|
||||||
Fixed in develop branch for release v1.7.9:
|
Fixed in develop branch for release v1.7.9:
|
||||||
|
Loading…
Reference in New Issue
Block a user