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


PHP PHPExcel_Cell::attach方法代码示例

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


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

示例1: copyCellCollection

 /**
  *	Clone the cell collection
  *
  *	@return	void
  */
 public function copyCellCollection(PHPExcel_Worksheet $parent)
 {
     $this->_parent = $parent;
     if (!is_null($this->_currentObject) && is_object($this->_currentObject)) {
         $this->_currentObject->attach($parent);
     }
 }
开发者ID:blindest,项目名称:Yii-CMS-2.0,代码行数:12,代码来源:CacheBase.php

示例2: copyCellCollection

 /**
  * Clone the cell collection
  *
  * @param    PHPExcel_Worksheet $parent The new worksheet
  *
  * @return    void
  */
 public function copyCellCollection(PHPExcel_Worksheet $parent)
 {
     $this->_currentCellIsDirty;
     $this->_storeData();
     $this->_parent = $parent;
     if ($this->_currentObject !== null && is_object($this->_currentObject)) {
         $this->_currentObject->attach($this);
     }
 }
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:16,代码来源:CacheBase.php

示例3: _processTokenStack


//.........这里部分代码省略.........
                         }
                         $this->_debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->_showTypeDetails($cellValue));
                         //							$cellRef = $matches[2].'!'.$cellRef;
                     } else {
                         //							echo '$cellRef='.$cellRef.' in current worksheet<br />';
                         $this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in current worksheet');
                         if ($pCellParent !== NULL) {
                             $cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, FALSE);
                         } else {
                             return $this->_raiseFormulaError('Unable to access Cell Reference');
                         }
                         $this->_debugLog->writeDebugLog('Evaluation Result for cells ', $cellRef, ' is ', $this->_showTypeDetails($cellValue));
                     }
                 }
             } else {
                 //					echo 'Reference is a single Cell<br />';
                 if ($pCell === NULL) {
                     //						We can't access the cell, so return a REF error
                     $cellValue = PHPExcel_Calculation_Functions::REF();
                 } else {
                     $cellRef = $matches[6] . $matches[7];
                     if ($matches[2] > '') {
                         $matches[2] = trim($matches[2], "\"'");
                         if (strpos($matches[2], '[') !== FALSE || strpos($matches[2], ']') !== FALSE) {
                             //	It's a Reference to an external workbook (not currently supported)
                             return $this->_raiseFormulaError('Unable to access External Workbook');
                         }
                         //							echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
                         $this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]);
                         if ($pCellParent !== NULL) {
                             $cellSheet = $this->_workbook->getSheetByName($matches[2]);
                             if ($cellSheet && $cellSheet->cellExists($cellRef)) {
                                 $cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($matches[2]), FALSE);
                                 $pCell->attach($pCellParent);
                             } else {
                                 $cellValue = NULL;
                             }
                         } else {
                             return $this->_raiseFormulaError('Unable to access Cell Reference');
                         }
                         $this->_debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' in worksheet ', $matches[2], ' is ', $this->_showTypeDetails($cellValue));
                         //							$cellRef = $matches[2].'!'.$cellRef;
                     } else {
                         //							echo '$cellRef='.$cellRef.' in current worksheet<br />';
                         $this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in current worksheet');
                         if ($pCellParent->isDataSet($cellRef)) {
                             $cellValue = $this->extractCellRange($cellRef, $pCellWorksheet, FALSE);
                             $pCell->attach($pCellParent);
                         } else {
                             $cellValue = NULL;
                         }
                         $this->_debugLog->writeDebugLog('Evaluation Result for cell ', $cellRef, ' is ', $this->_showTypeDetails($cellValue));
                     }
                 }
             }
             $stack->push('Value', $cellValue, $cellRef);
             // if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on
         } elseif (preg_match('/^' . self::CALCULATION_REGEXP_FUNCTION . '$/i', $token, $matches)) {
             //				echo 'Token is a function<br />';
             $functionName = $matches[1];
             $argCount = $stack->pop();
             $argCount = $argCount['value'];
             if ($functionName != 'MKMATRIX') {
                 $this->_debugLog->writeDebugLog('Evaluating Function ', self::_localeFunc($functionName), '() with ', $argCount == 0 ? 'no' : $argCount, ' argument', $argCount == 1 ? '' : 's');
             }
             if (isset(self::$_PHPExcelFunctions[$functionName]) || isset(self::$_controlFunctions[$functionName])) {
开发者ID:Princelo,项目名称:bioerp,代码行数:67,代码来源:Calculation.php

示例4: _writeCell

 /**
  * Write Cell
  *
  * @param	PHPExcel_Shared_XMLWriter	$objWriter				XML Writer
  * @param	PHPExcel_Worksheet			$pSheet					Worksheet
  * @param	PHPExcel_Cell				$pCell					Cell
  * @param	string[]					$pStringTable			String table
  * @param	string[]					$pFlippedStringTable	String table (flipped), for faster index searching
  * @throws	Exception
  */
 private function _writeCell(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, PHPExcel_Cell $pCell = null, $pStringTable = null, $pFlippedStringTable = null)
 {
     $pCell->attach($pSheet);
     if (is_array($pStringTable) && is_array($pFlippedStringTable)) {
         // Cell
         $objWriter->startElement('c');
         $objWriter->writeAttribute('r', $pCell->getCoordinate());
         // Sheet styles
         if ($pCell->getXfIndex() != '') {
             $objWriter->writeAttribute('s', $pCell->getXfIndex());
         }
         // If cell value is supplied, write cell value
         if (is_object($pCell->getValue()) || $pCell->getValue() !== '') {
             // Map type
             $mappedType = $pCell->getDataType();
             // Write data type depending on its type
             switch (strtolower($mappedType)) {
                 case 'inlinestr':
                     // Inline string
                     $objWriter->writeAttribute('t', $mappedType);
                     break;
                 case 's':
                     // String
                     $objWriter->writeAttribute('t', $mappedType);
                     break;
                 case 'b':
                     // Boolean
                     $objWriter->writeAttribute('t', $mappedType);
                     break;
                 case 'f':
                     // Formula
                     $calculatedValue = null;
                     if ($this->getParentWriter()->getPreCalculateFormulas()) {
                         $calculatedValue = $pCell->getCalculatedValue();
                     } else {
                         $calculatedValue = $pCell->getValue();
                     }
                     if (is_string($calculatedValue)) {
                         $objWriter->writeAttribute('t', 'str');
                     }
                     break;
                 case 'e':
                     // Error
                     $objWriter->writeAttribute('t', $mappedType);
             }
             // Write data depending on its type
             switch (strtolower($mappedType)) {
                 case 'inlinestr':
                     // Inline string
                     if (!$pCell->getValue() instanceof PHPExcel_RichText) {
                         $objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML(htmlspecialchars($pCell->getValue())));
                     } else {
                         if ($pCell->getValue() instanceof PHPExcel_RichText) {
                             $objWriter->startElement('is');
                             $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pCell->getValue());
                             $objWriter->endElement();
                         }
                     }
                     break;
                 case 's':
                     // String
                     if (!$pCell->getValue() instanceof PHPExcel_RichText) {
                         if (isset($pFlippedStringTable[$pCell->getValue()])) {
                             $objWriter->writeElement('v', $pFlippedStringTable[$pCell->getValue()]);
                         }
                     } else {
                         if ($pCell->getValue() instanceof PHPExcel_RichText) {
                             $objWriter->writeElement('v', $pFlippedStringTable[$pCell->getValue()->getHashCode()]);
                         }
                     }
                     break;
                 case 'f':
                     // Formula
                     $objWriter->writeElement('f', substr($pCell->getValue(), 1));
                     if ($this->getParentWriter()->getOffice2003Compatibility() === false) {
                         if ($this->getParentWriter()->getPreCalculateFormulas()) {
                             $calculatedValue = $pCell->getCalculatedValue();
                             if (!is_array($calculatedValue) && substr($calculatedValue, 0, 1) != '#') {
                                 $v = PHPExcel_Shared_String::FormatNumber($calculatedValue);
                                 $objWriter->writeElement('v', $v);
                             } else {
                                 $objWriter->writeElement('v', '0');
                             }
                         } else {
                             $objWriter->writeElement('v', '0');
                         }
                     }
                     break;
                 case 'n':
                     // Numeric
//.........这里部分代码省略.........
开发者ID:bshaffer,项目名称:Donate-Nashville,代码行数:101,代码来源:Worksheet.php


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