You are here

public function PHPExcel_Worksheet_AutoFilter::shiftColumn in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/AutoFilter.php \PHPExcel_Worksheet_AutoFilter::shiftColumn()

* Shift an AutoFilter Column Rule to a different column * * Note: This method bypasses validation of the destination column to ensure it is within this AutoFilter range. * Nor does it verify whether any column rule already exists at $toColumn, but will simply overrideany existing value. * Use with caution. * *

Parameters

string $fromColumn Column name (e.g. A): * @param string $toColumn Column name (e.g. B) * @return PHPExcel_Worksheet_AutoFilter

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Worksheet/AutoFilter.php, line 274

Class

PHPExcel_Worksheet_AutoFilter
PHPExcel_Worksheet_AutoFilter

Code

public function shiftColumn($fromColumn = NULL, $toColumn = NULL) {
  $fromColumn = strtoupper($fromColumn);
  $toColumn = strtoupper($toColumn);
  if ($fromColumn !== NULL && isset($this->_columns[$fromColumn]) && $toColumn !== NULL) {
    $this->_columns[$fromColumn]
      ->setParent();
    $this->_columns[$fromColumn]
      ->setColumnIndex($toColumn);
    $this->_columns[$toColumn] = $this->_columns[$fromColumn];
    $this->_columns[$toColumn]
      ->setParent($this);
    unset($this->_columns[$fromColumn]);
    ksort($this->_columns);
  }
  return $this;
}