本文整理汇总了PHP中PHPExcel_Cell::getRow方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Cell::getRow方法的具体用法?PHP PHPExcel_Cell::getRow怎么用?PHP PHPExcel_Cell::getRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Cell
的用法示例。
在下文中一共展示了PHPExcel_Cell::getRow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compareCells
/**
* Compare 2 cells
*
* @param PHPExcel_Cell $a Cell a
* @param PHPExcel_Cell $b Cell b
*
* @return int Result of comparison (always -1 or 1, never zero!)
*/
public static function compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b)
{
if ($a->getRow() < $b->getRow()) {
return -1;
} elseif ($a->getRow() > $b->getRow()) {
return 1;
} elseif (self::columnIndexFromString($a->getColumn()) < self::columnIndexFromString($b->getColumn())) {
return -1;
} else {
return 1;
}
}
示例2: _processTokenStack
private function _processTokenStack($tokens, $cellID = NULL, PHPExcel_Cell $pCell = NULL)
{
if ($tokens == FALSE) {
return FALSE;
}
// If we're using cell caching, then $pCell may well be flushed back to the cache (which detaches the parent cell collection),
// so we store the parent cell collection so that we can re-attach it when necessary
$pCellWorksheet = $pCell !== NULL ? $pCell->getWorksheet() : NULL;
$pCellParent = $pCell !== NULL ? $pCell->getParent() : null;
$stack = new PHPExcel_Calculation_Token_Stack();
// Loop through each token in turn
foreach ($tokens as $tokenData) {
// print_r($tokenData);
// echo '<br />';
$token = $tokenData['value'];
// echo '<b>Token is '.$token.'</b><br />';
// if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack
if (isset(self::$_binaryOperators[$token])) {
// echo 'Token is a binary operator<br />';
// We must have two operands, error if we don't
if (($operand2Data = $stack->pop()) === NULL) {
return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
}
if (($operand1Data = $stack->pop()) === NULL) {
return $this->_raiseFormulaError('Internal error - Operand value missing from stack');
}
$operand1 = self::_dataTestReference($operand1Data);
$operand2 = self::_dataTestReference($operand2Data);
// Log what we're doing
if ($token == ':') {
$this->_debugLog->writeDebugLog('Evaluating Range ', $this->_showValue($operand1Data['reference']), ' ', $token, ' ', $this->_showValue($operand2Data['reference']));
} else {
$this->_debugLog->writeDebugLog('Evaluating ', $this->_showValue($operand1), ' ', $token, ' ', $this->_showValue($operand2));
}
// Process the operation in the appropriate manner
switch ($token) {
// Comparison (Boolean) Operators
case '>':
// Greater than
// Greater than
case '<':
// Less than
// Less than
case '>=':
// Greater than or Equal to
// Greater than or Equal to
case '<=':
// Less than or Equal to
// Less than or Equal to
case '=':
// Equality
// Equality
case '<>':
// Inequality
$this->_executeBinaryComparisonOperation($cellID, $operand1, $operand2, $token, $stack);
break;
// Binary Operators
// Binary Operators
case ':':
// Range
$sheet1 = $sheet2 = '';
if (strpos($operand1Data['reference'], '!') !== FALSE) {
list($sheet1, $operand1Data['reference']) = explode('!', $operand1Data['reference']);
} else {
$sheet1 = $pCellParent !== NULL ? $pCellWorksheet->getTitle() : '';
}
if (strpos($operand2Data['reference'], '!') !== FALSE) {
list($sheet2, $operand2Data['reference']) = explode('!', $operand2Data['reference']);
} else {
$sheet2 = $sheet1;
}
if ($sheet1 == $sheet2) {
if ($operand1Data['reference'] === NULL) {
if (trim($operand1Data['value']) != '' && is_numeric($operand1Data['value'])) {
$operand1Data['reference'] = $pCell->getColumn() . $operand1Data['value'];
} elseif (trim($operand1Data['reference']) == '') {
$operand1Data['reference'] = $pCell->getCoordinate();
} else {
$operand1Data['reference'] = $operand1Data['value'] . $pCell->getRow();
}
}
if ($operand2Data['reference'] === NULL) {
if (trim($operand2Data['value']) != '' && is_numeric($operand2Data['value'])) {
$operand2Data['reference'] = $pCell->getColumn() . $operand2Data['value'];
} elseif (trim($operand2Data['reference']) == '') {
$operand2Data['reference'] = $pCell->getCoordinate();
} else {
$operand2Data['reference'] = $operand2Data['value'] . $pCell->getRow();
}
}
$oData = array_merge(explode(':', $operand1Data['reference']), explode(':', $operand2Data['reference']));
$oCol = $oRow = array();
foreach ($oData as $oDatum) {
$oCR = PHPExcel_Cell::coordinateFromString($oDatum);
$oCol[] = PHPExcel_Cell::columnIndexFromString($oCR[0]) - 1;
$oRow[] = $oCR[1];
}
$cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)) . min($oRow) . ':' . PHPExcel_Cell::stringFromColumnIndex(max($oCol)) . max($oRow);
if ($pCellParent !== NULL) {
$cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($sheet1), FALSE);
//.........这里部分代码省略.........
示例3: getDay
/**
* @param PHPExcel $objPHPExcel
* @param PHPExcel_Worksheet $sheet
* @param string $col
* @param int|string $row
* @param string $day
* @return bool
* @throws PHPExcel_Exception
*/
function getDay(PHPExcel $objPHPExcel, PHPExcel_Worksheet $sheet, PHPExcel_Cell $cell, $arr_filter)
{
$g = true;
$b = false;
$objPHPExcel->setActiveSheetIndexByName($sheet->getTitle());
$act_sheet = $objPHPExcel->getActiveSheet();
$index_sheet = $objPHPExcel->getActiveSheetIndex();
$row = $cell->getRow();
$column = $cell->getColumn();
// $cell_v=$cell->getFormattedValue();
$columnHiestIndex = PHPExcel_Cell::columnIndexFromString($act_sheet->getHighestColumn($row));
$rowHiestIndex = $act_sheet->getHighestRow();
$column = PHPExcel_Cell::columnIndexFromString($column);
//$this->testEcho($rowHiestIndex);
$cell_value = '';
for ($i = 0; $i < $column; $i++) {
$cell_value = $this->getValueMergedCell($objPHPExcel, $index_sheet, $this->arr_merged_allCells, $i, $row);
// $this->testEcho($cell_value);
if (in_array($cell_value, $arr_filter)) {
//
// $this->testEcho($cell_value);
$b = true;
}
if ($b) {
$g = false;
break;
}
}
if ($g) {
for ($i = $column + 1; $i <= $columnHiestIndex; $i++) {
$cell_value = $this->getValueMergedCell($objPHPExcel, $index_sheet, $this->arr_merged_allCells, $i, $row);
// $this->testEcho($cell_value);
if (in_array($cell_value, $arr_filter)) {
// $this->testEcho($cell_value);
$b = true;
}
if ($b) {
$g = false;
break;
}
}
}
if ($g) {
for ($i = 0; $i < $row; $i++) {
$cell_value = $this->getValueMergedCell($objPHPExcel, $index_sheet, $this->arr_merged_allCells, $column, $i);
// $this->testEcho($cell_value);
if (in_array($cell_value, $arr_filter)) {
// $this->testEcho($cell_value);
$b = true;
}
if ($b) {
$g = false;
break;
}
}
}
if ($g) {
for ($i = $row + 1; $i <= $rowHiestIndex; $i++) {
$cell_value = $this->getValueMergedCell($objPHPExcel, $index_sheet, $this->arr_merged_allCells, $column, $i);
// $this->testEcho($cell_value);
if (in_array($cell_value, $arr_filter)) {
// $this->testEcho($cell_value);
$b = true;
}
if ($b) {
break;
}
}
}
/*
for ($i = 0; $i <= $rowHiestIndex; $i++) {
$cell_value = $this->getValueMergedCell($objPHPExcel, $index_sheet, $this->arr_merged_allCells, $i, $row);
// $this->testEcho($cell_value);
if ($cell_value == $day) {
$this->testEcho($cell_value);
return $b = true;
}
}
$this->testEcho('Тестим B');
$this->testEcho($b);
if (!$b) {
$colHiestIndex = $sheet->getHighestRow($col);
$this->testEcho($colHiestIndex);
for ($i = 0; $i <= $colHiestIndex; $i++) {
$cell_value = $this->getValueMergedCell($objPHPExcel, $index_sheet, $this->arr_merged_allCells, $col, $i);
if ($cell_value == $day) {
$this->testEcho($cell_value);
}
}
}
*/
//.........这里部分代码省略.........