本文整理汇总了PHP中PHPExcel::getCalculationEngine方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel::getCalculationEngine方法的具体用法?PHP PHPExcel::getCalculationEngine怎么用?PHP PHPExcel::getCalculationEngine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel
的用法示例。
在下文中一共展示了PHPExcel::getCalculationEngine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setTitle
/**
* Set title
*
* @param string $pValue String containing the dimension of this worksheet
* @param string $updateFormulaCellReferences boolean Flag indicating whether cell references in formulae should
* be updated to reflect the new sheet name.
* This should be left as the default true, unless you are
* certain that no formula cells on any worksheet contain
* references to this worksheet
* @return PHPExcel_Worksheet
*/
public function setTitle($pValue = 'Worksheet', $updateFormulaCellReferences = true)
{
// Is this a 'rename' or not?
if ($this->getTitle() == $pValue) {
return $this;
}
// Syntax check
self::checkSheetTitle($pValue);
// Old title
$oldTitle = $this->getTitle();
if ($this->parent) {
// Is there already such sheet name?
if ($this->parent->sheetNameExists($pValue)) {
// Use name, but append with lowest possible integer
if (PHPExcel_Shared_String::CountCharacters($pValue) > 29) {
$pValue = PHPExcel_Shared_String::Substring($pValue, 0, 29);
}
$i = 1;
while ($this->parent->sheetNameExists($pValue . ' ' . $i)) {
++$i;
if ($i == 10) {
if (PHPExcel_Shared_String::CountCharacters($pValue) > 28) {
$pValue = PHPExcel_Shared_String::Substring($pValue, 0, 28);
}
} elseif ($i == 100) {
if (PHPExcel_Shared_String::CountCharacters($pValue) > 27) {
$pValue = PHPExcel_Shared_String::Substring($pValue, 0, 27);
}
}
}
$altTitle = $pValue . ' ' . $i;
return $this->setTitle($altTitle, $updateFormulaCellReferences);
}
}
// Set title
$this->title = $pValue;
$this->dirty = true;
if ($this->parent && $this->parent->getCalculationEngine()) {
// New title
$newTitle = $this->getTitle();
$this->parent->getCalculationEngine()->renameCalculationCacheForWorksheet($oldTitle, $newTitle);
if ($updateFormulaCellReferences) {
PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->parent, $oldTitle, $newTitle);
}
}
return $this;
}
示例2: getInstance
/**
* Get an instance of this class
*
* @access public
* @param PHPExcel $workbook Injected workbook for working with a PHPExcel object,
* or NULL to create a standalone claculation engine
* @return PHPExcel_Calculation
*/
public static function getInstance(PHPExcel $workbook = null)
{
if ($workbook !== null) {
$instance = $workbook->getCalculationEngine();
if (isset($instance)) {
return $instance;
}
}
if (!isset(self::$instance) || self::$instance === null) {
self::$instance = new PHPExcel_Calculation();
}
return self::$instance;
}