当前位置: 首页>>代码示例>>PHP>>正文


PHP Cell::getWorksheet方法代码示例

本文整理汇总了PHP中Cell::getWorksheet方法的典型用法代码示例。如果您正苦于以下问题:PHP Cell::getWorksheet方法的具体用法?PHP Cell::getWorksheet怎么用?PHP Cell::getWorksheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cell的用法示例。


在下文中一共展示了Cell::getWorksheet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processTokenStack

 private function processTokenStack($tokens, $cellID = null, 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 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 = Cell::coordinateFromString($oDatum);
                             $oCol[] = Cell::columnIndexFromString($oCR[0]) - 1;
                             $oRow[] = $oCR[1];
                         }
                         $cellRef = Cell::stringFromColumnIndex(min($oCol)) . min($oRow) . ':' . Cell::stringFromColumnIndex(max($oCol)) . max($oRow);
                         if ($pCellParent !== null) {
                             $cellValue = $this->extractCellRange($cellRef, $this->spreadsheet->getSheetByName($sheet1), false);
//.........这里部分代码省略.........
开发者ID:kameshwariv,项目名称:testexample,代码行数:101,代码来源:Calculation.php


注:本文中的Cell::getWorksheet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。