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


PHP PHPExcel::getNamedRanges方法代码示例

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


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

示例1: rebindParent

 /**
  * Re-bind parent
  *
  * @param PHPExcel $parent
  */
 public function rebindParent(PHPExcel $parent)
 {
     $namedRanges = $this->_parent->getNamedRanges();
     foreach ($namedRanges as $namedRange) {
         $parent->addNamedRange($namedRange);
     }
     $this->_parent->removeSheetByIndex($this->_parent->getindex($this));
     $this->_parent = $parent;
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:14,代码来源:Worksheet.php

示例2: rebindParent

 /**
  * Re-bind parent
  *
  * @param PHPExcel $parent
  * @return PHPExcel_Worksheet
  */
 public function rebindParent(PHPExcel $parent)
 {
     if ($this->parent !== null) {
         $namedRanges = $this->parent->getNamedRanges();
         foreach ($namedRanges as $namedRange) {
             $parent->addNamedRange($namedRange);
         }
         $this->parent->removeSheetByIndex($this->parent->getIndex($this));
     }
     $this->parent = $parent;
     return $this;
 }
开发者ID:alyayazilim,项目名称:E-Ticaret-2015,代码行数:18,代码来源:Worksheet.php

示例3: _writeNamedRanges

 /**
  * Write named ranges
  *
  * @param 	PHPExcel_Shared_XMLWriter	$objWriter 		XML Writer
  * @param 	PHPExcel					$pPHPExcel
  * @throws 	PHPExcel_Writer_Exception
  */
 private function _writeNamedRanges(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel $pPHPExcel)
 {
     // Loop named ranges
     $namedRanges = $pPHPExcel->getNamedRanges();
     foreach ($namedRanges as $namedRange) {
         $this->_writeDefinedNameForNamedRange($objWriter, $namedRange);
     }
 }
开发者ID:Princelo,项目名称:bioerp,代码行数:15,代码来源:Workbook.php

示例4: writeAllDefinedNamesBiff8

 /**
  * Writes all the DEFINEDNAME records (BIFF8).
  * So far this is only used for repeating rows/columns (print titles) and print areas
  */
 private function writeAllDefinedNamesBiff8()
 {
     $chunk = '';
     // Named ranges
     if (count($this->phpExcel->getNamedRanges()) > 0) {
         // Loop named ranges
         $namedRanges = $this->phpExcel->getNamedRanges();
         foreach ($namedRanges as $namedRange) {
             // Create absolute coordinate
             $range = PHPExcel_Cell::splitRange($namedRange->getRange());
             for ($i = 0; $i < count($range); $i++) {
                 $range[$i][0] = '\'' . str_replace("'", "''", $namedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteCoordinate($range[$i][0]);
                 if (isset($range[$i][1])) {
                     $range[$i][1] = PHPExcel_Cell::absoluteCoordinate($range[$i][1]);
                 }
             }
             $range = PHPExcel_Cell::buildRange($range);
             // e.g. Sheet1!$A$1:$B$2
             // parse formula
             try {
                 $error = $this->parser->parse($range);
                 $formulaData = $this->parser->toReversePolish();
                 // make sure tRef3d is of type tRef3dR (0x3A)
                 if (isset($formulaData[0]) and ($formulaData[0] == "z" or $formulaData[0] == "Z")) {
                     $formulaData = ":" . substr($formulaData, 1);
                 }
                 if ($namedRange->getLocalOnly()) {
                     // local scope
                     $scope = $this->phpExcel->getIndex($namedRange->getScope()) + 1;
                 } else {
                     // global scope
                     $scope = 0;
                 }
                 $chunk .= $this->writeData($this->writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false));
             } catch (PHPExcel_Exception $e) {
                 // do nothing
             }
         }
     }
     // total number of sheets
     $total_worksheets = $this->phpExcel->getSheetCount();
     // write the print titles (repeating rows, columns), if any
     for ($i = 0; $i < $total_worksheets; ++$i) {
         $sheetSetup = $this->phpExcel->getSheet($i)->getPageSetup();
         // simultaneous repeatColumns repeatRows
         if ($sheetSetup->isColumnsToRepeatAtLeftSet() && $sheetSetup->isRowsToRepeatAtTopSet()) {
             $repeat = $sheetSetup->getColumnsToRepeatAtLeft();
             $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
             $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
             $repeat = $sheetSetup->getRowsToRepeatAtTop();
             $rowmin = $repeat[0] - 1;
             $rowmax = $repeat[1] - 1;
             // construct formula data manually
             $formulaData = pack('Cv', 0x29, 0x17);
             // tMemFunc
             $formulaData .= pack('Cvvvvv', 0x3b, $i, 0, 65535, $colmin, $colmax);
             // tArea3d
             $formulaData .= pack('Cvvvvv', 0x3b, $i, $rowmin, $rowmax, 0, 255);
             // tArea3d
             $formulaData .= pack('C', 0x10);
             // tList
             // store the DEFINEDNAME record
             $chunk .= $this->writeData($this->writeDefinedNameBiff8(pack('C', 0x7), $formulaData, $i + 1, true));
             // (exclusive) either repeatColumns or repeatRows
         } elseif ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
             // Columns to repeat
             if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
                 $repeat = $sheetSetup->getColumnsToRepeatAtLeft();
                 $colmin = PHPExcel_Cell::columnIndexFromString($repeat[0]) - 1;
                 $colmax = PHPExcel_Cell::columnIndexFromString($repeat[1]) - 1;
             } else {
                 $colmin = 0;
                 $colmax = 255;
             }
             // Rows to repeat
             if ($sheetSetup->isRowsToRepeatAtTopSet()) {
                 $repeat = $sheetSetup->getRowsToRepeatAtTop();
                 $rowmin = $repeat[0] - 1;
                 $rowmax = $repeat[1] - 1;
             } else {
                 $rowmin = 0;
                 $rowmax = 65535;
             }
             // construct formula data manually because parser does not recognize absolute 3d cell references
             $formulaData = pack('Cvvvvv', 0x3b, $i, $rowmin, $rowmax, $colmin, $colmax);
             // store the DEFINEDNAME record
             $chunk .= $this->writeData($this->writeDefinedNameBiff8(pack('C', 0x7), $formulaData, $i + 1, true));
         }
     }
     // write the print areas, if any
     for ($i = 0; $i < $total_worksheets; ++$i) {
         $sheetSetup = $this->phpExcel->getSheet($i)->getPageSetup();
         if ($sheetSetup->isPrintAreaSet()) {
             // Print area, e.g. A3:J6,H1:X20
             $printArea = PHPExcel_Cell::splitRange($sheetSetup->getPrintArea());
             $countPrintArea = count($printArea);
//.........这里部分代码省略.........
开发者ID:jaya-project,项目名称:zycms,代码行数:101,代码来源:Workbook.php


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