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


PHP PHPExcel::getNamedRange方法代码示例

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


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

示例1: testSimple

 public function testSimple()
 {
     $data = ['ROOT' => ['LEVEL1' => [['LEVEL1_CAPTION' => '1'], ['LEVEL1_CAPTION' => '2']]]];
     $namedRange = $this->output->getNamedRange('ROOT');
     $this->sut->write($data, $namedRange);
     $this->output->setActiveSheetIndexByName('TEMPLATE');
     $this->output->removeSheetByIndex($this->output->getActiveSheetIndex());
     $excelWriter = \PHPExcel_IOFactory::createWriter($this->output, 'Excel2007');
     $excelWriter->save(__DIR__ . '/../metadata/output/verticalrangewritertest.xlsx');
 }
开发者ID:mathielen,项目名称:report-write-engine,代码行数:10,代码来源:VerticalRangeWriterTest.php

示例2: date

// Add some data
echo date('H:i:s') . " Add some data\n";
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Firstname:');
$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Lastname:');
$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Fullname:');
$objPHPExcel->getActiveSheet()->setCellValue('B1', 'Maarten');
$objPHPExcel->getActiveSheet()->setCellValue('B2', 'Balliauw');
$objPHPExcel->getActiveSheet()->setCellValue('B3', '=B1 & " " & B2');
// Define named ranges
echo date('H:i:s') . " Define named ranges\n";
$objPHPExcel->addNamedRange(new PHPExcel_NamedRange('PersonName', $objPHPExcel->getActiveSheet(), 'B1'));
$objPHPExcel->addNamedRange(new PHPExcel_NamedRange('PersonLN', $objPHPExcel->getActiveSheet(), 'B2'));
// Rename named ranges
echo date('H:i:s') . " Rename named ranges\n";
$objPHPExcel->getNamedRange('PersonName')->setName('PersonFN');
// Rename sheet
echo date('H:i:s') . " Rename sheet\n";
$objPHPExcel->getActiveSheet()->setTitle('Person');
// Create a new worksheet, after the default sheet
echo date('H:i:s') . " Create new Worksheet object\n";
$objPHPExcel->createSheet();
// Add some data to the second sheet, resembling some different data types
echo date('H:i:s') . " Add some data\n";
$objPHPExcel->setActiveSheetIndex(1);
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Firstname:');
$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Lastname:');
$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Fullname:');
$objPHPExcel->getActiveSheet()->setCellValue('B1', '=PersonFN');
$objPHPExcel->getActiveSheet()->setCellValue('B2', '=PersonLN');
$objPHPExcel->getActiveSheet()->setCellValue('B3', '=PersonFN & " " & PersonLN');
开发者ID:quantrocket,项目名称:planlogiq,代码行数:31,代码来源:19namedrange.php


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