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


PHP PHPExcel_ReferenceHelper::getInstance方法代码示例

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


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

示例1: _castToFormula

	private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) {
//		echo '<font color="darkgreen">Formula</font><br />';
//		echo '$c->f is '.$c->f.'<br />';
		$cellDataType 		= 'f';
		$value 				= "={$c->f}";
		$calculatedValue 	= $this->$castBaseType($c);

		// Shared formula?
		if (isset($c->f['t']) && strtolower((string)$c->f['t']) == 'shared') {
//			echo '<font color="darkgreen">SHARED FORMULA</font><br />';
			$instance = (string)$c->f['si'];

//			echo 'Instance ID = '.$instance.'<br />';
//
//			echo 'Shared Formula Array:<pre>';
//			print_r($sharedFormulas);
//			echo '</pre>';
			if (!isset($sharedFormulas[(string)$c->f['si']])) {
//				echo '<font color="darkgreen">SETTING NEW SHARED FORMULA</font><br />';
//				echo 'Master is '.$r.'<br />';
//				echo 'Formula is '.$value.'<br />';
				$sharedFormulas[$instance] = array(	'master' => $r,
													'formula' => $value
												  );
//				echo 'New Shared Formula Array:<pre>';
//				print_r($sharedFormulas);
//				echo '</pre>';
			} else {
//				echo '<font color="darkgreen">GETTING SHARED FORMULA</font><br />';
//				echo 'Master is '.$sharedFormulas[$instance]['master'].'<br />';
//				echo 'Formula is '.$sharedFormulas[$instance]['formula'].'<br />';
				$master = PHPExcel_Cell::coordinateFromString($sharedFormulas[$instance]['master']);
				$current = PHPExcel_Cell::coordinateFromString($r);

				$difference = array(0, 0);
				$difference[0] = PHPExcel_Cell::columnIndexFromString($current[0]) - PHPExcel_Cell::columnIndexFromString($master[0]);
				$difference[1] = $current[1] - $master[1];

				$helper = PHPExcel_ReferenceHelper::getInstance();
				$value = $helper->updateFormulaReferences(	$sharedFormulas[$instance]['formula'],
															'A1',
															$difference[0],
															$difference[1]
														 );
//				echo 'Adjusted Formula is '.$value.'<br />';
			}
		}
	}
开发者ID:Opmantek,项目名称:open-audit,代码行数:48,代码来源:Excel2007.php

示例2: removeColumn

 /**
  * Remove a column, updating all possible related data
  *
  * @param int $pColumn    Remove starting with this one
  * @param int $pNumCols    Number of columns to remove
  * @throws    PHPExcel_Exception
  * @return PHPExcel_Worksheet
  */
 public function removeColumn($pColumn = 'A', $pNumCols = 1)
 {
     if (!is_numeric($pColumn)) {
         $pColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($pColumn) - 1 + $pNumCols);
         $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
         $objReferenceHelper->insertNewBefore($pColumn . '1', -$pNumCols, 0, $this);
     } else {
         throw new PHPExcel_Exception("Column references should not be numeric.");
     }
     return $this;
 }
开发者ID:andrelotto,项目名称:EmailMarketing,代码行数:19,代码来源:Worksheet.php

示例3: load


//.........这里部分代码省略.........
                                         } else {
                                             $value = (bool) $c->v;
                                         }
                                     }
                                     break;
                                 case "inlineStr":
                                     $value = $this->_parseRichText($c->is);
                                     break;
                                 case "e":
                                     if (!isset($c->f)) {
                                         $value = (string) $c->v;
                                     } else {
                                         $value = "={$c->f}";
                                     }
                                     break;
                                 default:
                                     if (!isset($c->f)) {
                                         $value = (string) $c->v;
                                     } else {
                                         // Formula
                                         $value = "={$c->f}";
                                         $cellDataType = 'f';
                                         // Shared formula?
                                         if (isset($c->f['t']) && strtolower((string) $c->f['t']) == 'shared') {
                                             $instance = (string) $c->f['si'];
                                             if (!isset($sharedFormulas[(string) $c->f['si']])) {
                                                 $sharedFormulas[$instance] = array('master' => $r, 'formula' => $value);
                                             } else {
                                                 $master = PHPExcel_Cell::coordinateFromString($sharedFormulas[$instance]['master']);
                                                 $current = PHPExcel_Cell::coordinateFromString($r);
                                                 $difference = array(0, 0);
                                                 $difference[0] = PHPExcel_Cell::columnIndexFromString($current[0]) - PHPExcel_Cell::columnIndexFromString($master[0]);
                                                 $difference[1] = $current[1] - $master[1];
                                                 $helper = PHPExcel_ReferenceHelper::getInstance();
                                                 $x = $helper->updateFormulaReferences($sharedFormulas[$instance]['formula'], 'A1', $difference[0], $difference[1]);
                                                 $value = $x;
                                             }
                                         }
                                     }
                                     break;
                             }
                             // Check for numeric values
                             if (is_numeric($value) && $cellDataType != 's') {
                                 if ($value == (int) $value) {
                                     $value = (int) $value;
                                 } elseif ($value == (double) $value) {
                                     $value = (double) $value;
                                 } elseif ($value == (double) $value) {
                                     $value = (double) $value;
                                 }
                             }
                             // Rich text?
                             if ($value instanceof PHPExcel_RichText && $this->_readDataOnly) {
                                 $value = $value->getPlainText();
                             }
                             // Assign value
                             if ($cellDataType != '') {
                                 $docSheet->setCellValueExplicit($r, $value, $cellDataType);
                             } else {
                                 $docSheet->setCellValue($r, $value);
                             }
                             // Style information?
                             if ($c["s"] && !$this->_readDataOnly) {
                                 if (isset($styles[intval($c["s"])])) {
                                     $this->_readStyle($docSheet->getStyle($r), $styles[intval($c["s"])]);
                                 }
开发者ID:eficklin,项目名称:Spreadsheet,代码行数:67,代码来源:Excel2007.php

示例4: setName

 /**
  * Set name
  *
  * @param string $value
  * @return PHPExcel_NamedRange
  */
 public function setName($value = null)
 {
     if ($value !== null) {
         // Old title
         $oldTitle = $this->name;
         // Re-attach
         if ($this->worksheet !== null) {
             $this->worksheet->getParent()->removeNamedRange($this->name, $this->worksheet);
         }
         $this->name = $value;
         if ($this->worksheet !== null) {
             $this->worksheet->getParent()->addNamedRange($this);
         }
         // New title
         $newTitle = $this->name;
         PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->worksheet->getParent(), $oldTitle, $newTitle);
     }
     return $this;
 }
开发者ID:oalkhanishvili,项目名称:track2,代码行数:25,代码来源:NamedRange.php

示例5: __construct

 /**
  * Create a new PHPExcel_Reader_Excel2007 instance
  */
 public function __construct()
 {
     $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
     $this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance();
 }
开发者ID:jimlongo56,项目名称:bhouse,代码行数:8,代码来源:Excel2007.php

示例6: removeColumn

 /**
  * Remove a column, updating all possible related data
  *
  * @param string    $pColumn     Remove starting with this one
  * @param int       $pNumCols    Number of columns to remove
  * @throws    PHPExcel_Exception
  * @return PHPExcel_Worksheet
  */
 public function removeColumn($pColumn = 'A', $pNumCols = 1)
 {
     if (!is_numeric($pColumn)) {
         $highestColumn = $this->getHighestDataColumn();
         $pColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($pColumn) - 1 + $pNumCols);
         $objReferenceHelper = PHPExcel_ReferenceHelper::getInstance();
         $objReferenceHelper->insertNewBefore($pColumn . '1', -$pNumCols, 0, $this);
         for ($c = 0; $c < $pNumCols; ++$c) {
             $this->getCellCacheController()->removeColumn($highestColumn);
             $highestColumn = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($highestColumn) - 2);
         }
     } else {
         throw new PHPExcel_Exception("Column references should not be numeric.");
     }
     return $this;
 }
开发者ID:Alex-AG,项目名称:exeltek-po,代码行数:24,代码来源:Worksheet.php


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