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


PHP PHPExcel_ReferenceHelper类代码示例

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


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

示例1: getInstance

 /**
  * Get an instance of this class
  *
  * @return PHPExcel_ReferenceHelper
  */
 public static function getInstance()
 {
     if (!isset(self::$_instance) || is_null(self::$_instance)) {
         self::$_instance = new PHPExcel_ReferenceHelper();
     }
     return self::$_instance;
 }
开发者ID:honj51,项目名称:taobaocrm,代码行数:12,代码来源:ReferenceHelper.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:hcvcastro,项目名称:pxp,代码行数: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

示例7: _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 = self::$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];
				
				$value = $this->_referenceHelper->updateFormulaReferences ( $sharedFormulas [$instance] ['formula'], 'A1', $difference [0], $difference [1] );
				// echo 'Adjusted Formula is '.$value.'<br />';
			}
		}
	}
开发者ID:nanpeixoto,项目名称:cide,代码行数:51,代码来源:Excel2007.php

示例8: _castToFormula

 private function _castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType)
 {
     $cellDataType = 'f';
     $value = "={$c->f}";
     $calculatedValue = self::$castBaseType($c);
     // 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];
             $value = $this->_referenceHelper->updateFormulaReferences($sharedFormulas[$instance]['formula'], 'A1', $difference[0], $difference[1]);
         }
     }
 }
开发者ID:skyosev,项目名称:OpenCart-Overclocked,代码行数:20,代码来源:Excel2007.php

示例9: castToFormula

 private function castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType)
 {
     //        echo 'Formula', PHP_EOL;
     //        echo '$c->f is ', $c->f, PHP_EOL;
     $cellDataType = 'f';
     $value = "={$c->f}";
     $calculatedValue = self::$castBaseType($c);
     // Shared formula?
     if (isset($c->f['t']) && strtolower((string) $c->f['t']) == 'shared') {
         //            echo 'SHARED FORMULA', PHP_EOL;
         $instance = (string) $c->f['si'];
         //            echo 'Instance ID = ', $instance, PHP_EOL;
         //
         //            echo 'Shared Formula Array:', PHP_EOL;
         //            print_r($sharedFormulas);
         if (!isset($sharedFormulas[(string) $c->f['si']])) {
             //                echo 'SETTING NEW SHARED FORMULA', PHP_EOL;
             //                echo 'Master is ', $r, PHP_EOL;
             //                echo 'Formula is ', $value, PHP_EOL;
             $sharedFormulas[$instance] = array('master' => $r, 'formula' => $value);
             //                echo 'New Shared Formula Array:', PHP_EOL;
             //                print_r($sharedFormulas);
         } else {
             //                echo 'GETTING SHARED FORMULA', PHP_EOL;
             //                echo 'Master is ', $sharedFormulas[$instance]['master'], PHP_EOL;
             //                echo 'Formula is ', $sharedFormulas[$instance]['formula'], PHP_EOL;
             $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];
             $value = $this->referenceHelper->updateFormulaReferences($sharedFormulas[$instance]['formula'], 'A1', $difference[0], $difference[1]);
             //                echo 'Adjusted Formula is ', $value, PHP_EOL;
         }
     }
 }
开发者ID:makranelhoucine,项目名称:pfa_ensaobox,代码行数:36,代码来源:Excel2007.php


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