You are here

public function PHPExcel_Worksheet::setSelectedCells in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php \PHPExcel_Worksheet::setSelectedCells()

Select a range of cells.

Parameters

string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6':

Return value

PHPExcel_Worksheet

Throws

PHPExcel_Exception

3 calls to PHPExcel_Worksheet::setSelectedCells()
PHPExcel_Worksheet::getStyle in vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php
Get style for cell
PHPExcel_Worksheet::setSelectedCell in vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php
Selected cell
PHPExcel_Worksheet::setSelectedCellByColumnAndRow in vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php
Selected cell by using numeric cell coordinates

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet.php, line 2335

Class

PHPExcel_Worksheet
PHPExcel_Worksheet

Code

public function setSelectedCells($pCoordinate = 'A1') {

  // Uppercase coordinate
  $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) {
    list($first, ) = PHPExcel_Cell::splitRange($pCoordinate);
    $this->_activeCell = $first[0];
  }
  else {
    $this->_activeCell = $pCoordinate;
  }
  $this->_selectedCells = $pCoordinate;
  return $this;
}