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


PHP Cell::getCoordinate方法代码示例

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


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

示例1: __construct

 /**
  * Create a new RichText instance
  *
  * @param Cell $pCell
  * @throws Exception
  */
 public function __construct(Cell $pCell = null)
 {
     // Initialise variables
     $this->richTextElements = array();
     // Rich-Text string attached to cell?
     if ($pCell !== null) {
         // Add cell text and style
         if ($pCell->getValue() != "") {
             $objRun = new RichText\Run($pCell->getValue());
             $objRun->setFont(clone $pCell->getParent()->getStyle($pCell->getCoordinate())->getFont());
             $this->addText($objRun);
         }
         // Set parent value
         $pCell->setValueExplicit($this, Cell\DataType::TYPE_STRING);
     }
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:22,代码来源:RichText.php

示例2: 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

示例3: updateCacheData

 /**
  *	Add or Update a cell in cache
  *
  *	@param	Cell	$cell		Cell to update
  *	@return	void
  *	@throws	Exception
  */
 public function updateCacheData(Cell $cell)
 {
     $pCoord = $cell->getCoordinate();
     return $this->addCacheData($pCoord, $cell);
 }
开发者ID:bestgoodz,项目名称:toko-baju,代码行数:12,代码来源:CacheBase.php

示例4: isDateTime

 /**
  * Is a given cell a date/time?
  *
  * @param	 Cell	$pCell
  * @return	 boolean
  */
 public static function isDateTime(Cell $pCell)
 {
     return self::isDateTimeFormat($pCell->getParent()->getStyle($pCell->getCoordinate())->getNumberFormat());
 }
开发者ID:bestgoodz,项目名称:toko-baju,代码行数:10,代码来源:Date.php

示例5: bindValue

 /**
  * Bind value to a cell
  *
  * @param Cell $cell	Cell to bind value to
  * @param mixed $value			Value to bind in cell
  * @return boolean
  */
 public function bindValue(Cell $cell, $value = null)
 {
     // sanitize UTF-8 strings
     if (is_string($value)) {
         $value = Shared_String::SanitizeUTF8($value);
     }
     // Find out data type
     $dataType = parent::dataTypeForValue($value);
     // Style logic - strings
     if ($dataType === Cell_DataType::TYPE_STRING && !$value instanceof RichText) {
         // Check for percentage
         if (preg_match('/^\\-?[0-9]*\\.?[0-9]*\\s?\\%$/', $value)) {
             // Convert value to number
             $cell->setValueExplicit((double) str_replace('%', '', $value) / 100, Cell_DataType::TYPE_NUMERIC);
             // Set style
             $cell->getParent()->getStyle($cell->getCoordinate())->getNumberFormat()->setFormatCode(Style_NumberFormat::FORMAT_PERCENTAGE);
             return true;
         }
         // Check for time without seconds e.g. '9:45', '09:45'
         if (preg_match('/^(\\d|[0-1]\\d|2[0-3]):[0-5]\\d$/', $value)) {
             list($h, $m) = explode(':', $value);
             $days = $h / 24 + $m / 1440;
             // Convert value to number
             $cell->setValueExplicit($days, Cell_DataType::TYPE_NUMERIC);
             // Set style
             $cell->getParent()->getStyle($cell->getCoordinate())->getNumberFormat()->setFormatCode(Style_NumberFormat::FORMAT_DATE_TIME3);
             return true;
         }
         // Check for time with seconds '9:45:59', '09:45:59'
         if (preg_match('/^(\\d|[0-1]\\d|2[0-3]):[0-5]\\d:[0-5]\\d$/', $value)) {
             list($h, $m, $s) = explode(':', $value);
             $days = $h / 24 + $m / 1440 + $s / 86400;
             // Convert value to number
             $cell->setValueExplicit($days, Cell_DataType::TYPE_NUMERIC);
             // Set style
             $cell->getParent()->getStyle($cell->getCoordinate())->getNumberFormat()->setFormatCode(Style_NumberFormat::FORMAT_DATE_TIME4);
             return true;
         }
         // Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10'
         if (($v = Shared_Date::stringToExcel($value)) !== false) {
             // Convert value to Excel date
             $cell->setValueExplicit($v, Cell_DataType::TYPE_NUMERIC);
             // Set style. Either there is a time part or not. Look for ':'
             if (strpos($value, ':') !== false) {
                 $formatCode = 'yyyy-mm-dd h:mm';
             } else {
                 $formatCode = 'yyyy-mm-dd';
             }
             $cell->getParent()->getStyle($cell->getCoordinate())->getNumberFormat()->setFormatCode($formatCode);
             return true;
         }
         // Check for newline character "\n"
         if (strpos($value, "\n") !== false) {
             $value = Shared_String::SanitizeUTF8($value);
             $cell->setValueExplicit($value, Cell_DataType::TYPE_STRING);
             // Set style
             $cell->getParent()->getStyle($cell->getCoordinate())->getAlignment()->setWrapText(true);
             return true;
         }
     }
     // Not bound yet? Use parent...
     return parent::bindValue($cell, $value);
 }
开发者ID:bestgoodz,项目名称:toko-baju,代码行数:70,代码来源:AdvancedValueBinder.php


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