本文整理汇总了PHP中PHPExcel_ReferenceHelper::updateFormulaReferences方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_ReferenceHelper::updateFormulaReferences方法的具体用法?PHP PHPExcel_ReferenceHelper::updateFormulaReferences怎么用?PHP PHPExcel_ReferenceHelper::updateFormulaReferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_ReferenceHelper
的用法示例。
在下文中一共展示了PHPExcel_ReferenceHelper::updateFormulaReferences方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 = 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 />';
}
}
}
示例2: _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]);
}
}
}
示例3: 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;
}
}
}