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


PHP PHPExcel::setActiveSheetIndexByName方法代码示例

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


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

 /**
  * @param PHPExcel $objPHPExcel
  * @param PHPExcel_Worksheet $sheet
  * @param string $col
  * @param int|string $row
  * @param string $day
  * @return bool
  * @throws PHPExcel_Exception
  */
 function getDay(PHPExcel $objPHPExcel, PHPExcel_Worksheet $sheet, PHPExcel_Cell $cell, $arr_filter)
 {
     $g = true;
     $b = false;
     $objPHPExcel->setActiveSheetIndexByName($sheet->getTitle());
     $act_sheet = $objPHPExcel->getActiveSheet();
     $index_sheet = $objPHPExcel->getActiveSheetIndex();
     $row = $cell->getRow();
     $column = $cell->getColumn();
     // $cell_v=$cell->getFormattedValue();
     $columnHiestIndex = PHPExcel_Cell::columnIndexFromString($act_sheet->getHighestColumn($row));
     $rowHiestIndex = $act_sheet->getHighestRow();
     $column = PHPExcel_Cell::columnIndexFromString($column);
     //$this->testEcho($rowHiestIndex);
     $cell_value = '';
     for ($i = 0; $i < $column; $i++) {
         $cell_value = $this->getValueMergedCell($objPHPExcel, $index_sheet, $this->arr_merged_allCells, $i, $row);
         //  $this->testEcho($cell_value);
         if (in_array($cell_value, $arr_filter)) {
             //
             //  $this->testEcho($cell_value);
             $b = true;
         }
         if ($b) {
             $g = false;
             break;
         }
     }
     if ($g) {
         for ($i = $column + 1; $i <= $columnHiestIndex; $i++) {
             $cell_value = $this->getValueMergedCell($objPHPExcel, $index_sheet, $this->arr_merged_allCells, $i, $row);
             //  $this->testEcho($cell_value);
             if (in_array($cell_value, $arr_filter)) {
                 //      $this->testEcho($cell_value);
                 $b = true;
             }
             if ($b) {
                 $g = false;
                 break;
             }
         }
     }
     if ($g) {
         for ($i = 0; $i < $row; $i++) {
             $cell_value = $this->getValueMergedCell($objPHPExcel, $index_sheet, $this->arr_merged_allCells, $column, $i);
             //  $this->testEcho($cell_value);
             if (in_array($cell_value, $arr_filter)) {
                 //     $this->testEcho($cell_value);
                 $b = true;
             }
             if ($b) {
                 $g = false;
                 break;
             }
         }
     }
     if ($g) {
         for ($i = $row + 1; $i <= $rowHiestIndex; $i++) {
             $cell_value = $this->getValueMergedCell($objPHPExcel, $index_sheet, $this->arr_merged_allCells, $column, $i);
             //  $this->testEcho($cell_value);
             if (in_array($cell_value, $arr_filter)) {
                 //         $this->testEcho($cell_value);
                 $b = true;
             }
             if ($b) {
                 break;
             }
         }
     }
     /*
             for ($i = 0; $i <= $rowHiestIndex; $i++) {
                 $cell_value = $this->getValueMergedCell($objPHPExcel, $index_sheet, $this->arr_merged_allCells, $i, $row);
               //  $this->testEcho($cell_value);
                 if ($cell_value == $day) {
                   $this->testEcho($cell_value);
                     return $b = true;
                 }
             }
             $this->testEcho('Тестим B');
             $this->testEcho($b);
             if (!$b) {
                 $colHiestIndex = $sheet->getHighestRow($col);
                 $this->testEcho($colHiestIndex);
                 for ($i = 0; $i <= $colHiestIndex; $i++) {
                     $cell_value = $this->getValueMergedCell($objPHPExcel, $index_sheet, $this->arr_merged_allCells, $col, $i);
                     if ($cell_value == $day) {
                         $this->testEcho($cell_value);
                   }
                 }
           }
     */
//.........这里部分代码省略.........
开发者ID:ViktorKITP,项目名称:schedule,代码行数:101,代码来源:finder.php

示例3: gotoSheetByTitle

 /**
  * Jump to sheet with string $title.
  * 
  * @param string $title
  * @return ExcelWriter
  */
 public function gotoSheetByTitle($title)
 {
     $this->objPHPExcel->setActiveSheetIndexByName($title);
     return $this;
 }
开发者ID:ChMat,项目名称:ExcelBundle,代码行数:11,代码来源:ExcelWriter.php

示例4: array

include 'C:/xampp/htdocs/CPI/functions.php';
$FE_ESTADO_DESDE_MENSUAL = $_REQUEST["FE_ESTADO_DESDE_MENSUAL"];
$FE_ESTADO_HASTA_MENSUAL = $_REQUEST["FE_ESTADO_HASTA_MENSUAL"];
$TABLAS = $_REQUEST["TABLAS"];
$TABLA_CONSULTAR = $_REQUEST["TABLA_CONSULTAR"];
$TABLA_SENTENCIA = $_REQUEST["TABLA_SENTENCIA"];
$OWNER = 'CPI';
$TABLA_TITULOS = 'TITULOS';
$SELECT = 'COUNT';
$descripcionArray = array();
$sentencia = '';
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("Tablero CPI")->setLastModifiedBy("Tablero CPI")->setTitle("Control")->setSubject("Control")->setDescription("Control")->setKeywords("pdf php")->setCategory("Control");
$objWorkSheet = $objPHPExcel->createSheet();
$objWorkSheet->setTitle('Consolidado');
$objPHPExcel->setActiveSheetIndexByName('Worksheet');
//nombre por default
$objPHPExcel->getActiveSheet()->setTitle('op');
//renombro la hoja
$sentencia = 'SELECT V_CHAR2 "Fecha Desde", V_CHAR3 "Fecha Hasta" FROM CPI.TMP_INDICADORES WHERE V_CHAR2 IS NOT NULL AND V_CHAR3 IS NOT NULL';
$sentenciaArray = cargarArray($sentencia);
$k = 1;
$Letra = 'A';
$Letra1 = 'B';
$Letra2 = 'C';
while ($k < count($sentenciaArray)) {
    $fe_dde = $sentenciaArray[$k][0];
    $fe_hta = $sentenciaArray[$k][1];
    $fePeriodo = date('m-Y', strtotime(str_replace('/', '-', $fe_dde)));
    //Me traigo el count de la tabla de la sentencia a consultar. Para poder hacer el while.
    $countTabla = "SELECT FUSS_NU_ID, FUSS_CD_TITULO FROM " . $OWNER . "." . $TABLA_SENTENCIA . "  ORDER BY 1";
开发者ID:erosennin93,项目名称:CPI,代码行数:31,代码来源:performanceProcesoMensual.php

示例5: clean

 protected function clean()
 {
     $this->output->setActiveSheetIndexByName('TEMPLATE');
     $this->output->removeSheetByIndex($this->output->getActiveSheetIndex());
 }
开发者ID:mathielen,项目名称:report-write-engine,代码行数:5,代码来源:ExcelCanvasWriter.php

示例6: export_data


//.........这里部分代码省略.........
                         $funds_for_manager = get_post_meta($solution_family_select, 'BH_funds', true);
                         $objPHPExcel->setActiveSheetIndex($count_month)->setCellValue('A3', __('Fund', 'bridgehouse'))->setCellValue('B3', __('Class', 'bridgehouse'))->setCellValue('C3', __('CAD Distribution', 'bridgehouse'))->setCellValue('D3', __('US Distribution', 'bridgehouse'));
                         //formating
                         $objPHPExcel->getActiveSheet()->getStyle('A3:D3')->applyFromArray(array('font' => array('bold' => true), 'borders' => array('top' => array('style' => PHPExcel_Style_Border::BORDER_THIN))));
                         $objPHPExcel->getActiveSheet()->getStyle('C3:D3')->applyFromArray(array('alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT)));
                         // loop funds
                         $row_count = 3;
                         //$row_start= 3;
                         $inner_row = 3;
                         foreach ($funds_for_manager as $fund) {
                             $fund_metabox->the_meta($fund);
                             //var_dump($fund_metabox);
                             $solution_fund_id = strtoupper($fund_metabox->get_the_value('short_code'));
                             // de have valuse for this fund
                             if (array_key_exists($solution_fund_id, $data)) {
                                 //$str .= '<tr><td>'.get_the_title($fund).'</td><td colspan="3">';
                                 $row_count++;
                                 $objPHPExcel->setActiveSheetIndex($count_month)->setCellValue('A' . $row_count, get_the_title($fund));
                                 //$str .= '<table>';
                                 foreach ($data[$solution_fund_id] as $key => $value) {
                                     $inner_row++;
                                     $objPHPExcel->setActiveSheetIndex($count_month)->setCellValue('B' . $inner_row, $key)->setCellValue('C' . $inner_row, number_format($value['cad'], 6, '.', ''))->setCellValue('D' . $inner_row, number_format($value['usd'], 6, '.', ''));
                                     $objPHPExcel->getActiveSheet()->getStyle('C' . $inner_row . ':D' . $inner_row)->getNumberFormat()->setFormatCode('##0.000000');
                                 }
                                 //$str .= '</table>';
                                 $objPHPExcel->getActiveSheet()->mergeCells('A' . $row_count . ':A' . $inner_row);
                                 $objPHPExcel->getActiveSheet()->getStyle('A' . $row_count)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
                                 $row_count = $inner_row;
                                 //$str .='<tr><td colspan=4></tr>';
                             }
                             // end if
                         }
                         //end for loop
                         $styleThinBorderOutline = array('borders' => array('inside' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('argb' => '000000')), 'outline' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('argb' => '000000'))));
                         $objPHPExcel->getActiveSheet()->getStyle('A1:D' . $row_count)->applyFromArray($styleThinBorderOutline);
                     }
                     //end if row check
                     $date_string = __('as of ', 'bridgehouse');
                     $date_string .= ucfirst(date_i18n(_x('F t Y H:i:s', 'prices date format', 'bridgehouse'), strtotime(date("F j, Y, H:i:s"))));
                     $footer_cell = $row_count + 1;
                     $objPHPExcel->setActiveSheetIndex($count_month)->setCellValue('A' . $footer_cell, __('Downloaded from BridgehouseCanada.com ', 'bridgehouse') . $date_string);
                     //$objPHPExcel->getActiveSheet()->mergeCells('A'.$footer_cell.':D'.$footer_cell);
                     $objPHPExcel->getActiveSheet()->getStyle('A' . $footer_cell)->getFont()->setBold(true);
                     $objPHPExcel->getActiveSheet()->getStyle('A' . $footer_cell)->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_DARKBLUE);
                     /*$footer_cell +=1;
                     	     // Echo memory peak usage
                     			$objPHPExcel->setActiveSheetIndex($count_month)
                     	            	->setCellValue('A'.$footer_cell, 'Peak memory usage: ' . (memory_get_peak_usage(true) / 1024 / 1024) . ' MB');
                     		*/
                     // Protect cells
                     $objPHPExcel->getActiveSheet()->getProtection()->setSheet(false);
                     // Needs to be set to true in order to enable any worksheet protection!
                     $count_month++;
                 }
                 //end month for loop
                 //ob_end_flush();
             }
             //end else
             //Set Web Form Date as Current Sheet
             $objPHPExcel->setActiveSheetIndexByName(ucfirst(date_i18n(_x('F j, Y', 'Payment date format', 'bridgehouse'), strtotime($this->distribution_month))));
             $file = __('Bridgehouse_Distributions', 'bridgehouse') . '_' . date_i18n(_x('F j Y', 'prices date format', 'bridgehouse'), strtotime(date("F j, Y, H:i:s")));
             //_'.$pay_date.".xls";
             $filename = str_replace(' ', '_', $file) . '.xls';
             //$file = str_replace("'","’",__(get_the_title($solution_fund_select),'bridgehouse')).'_'.$date_string.".xls";
             //$filename = $file;
             //header('Content-Encoding: UTF-8');
             //header('Content-Type: application/vnd.ms-excel');
             // Redirect output to a client’s web browser (Excel2007)
             header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
             header('Content-Disposition: attachment;filename=' . $filename);
             header('Cache-Control: max-age=0');
             $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
             //$objWriter->setOffice2003Compatibility(true);
             $objWriter->setUseDiskCaching(true);
             $objWriter->save('php://output');
             $objPHPExcel->disconnectWorksheets();
             unset($objPHPExcel);
             unset($objWriter);
             exit;
             /*header('Content-Encoding: UTF-8');
             		header("Content-type: application/vnd.ms-excel;"); // for .xls
                		header('Content-type: application/x-msdownload; charset=utf-16');
                		//header("Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, charset=utf-8;"); //for .xlsx
                		header("Content-Disposition: attachment; filename=" . $filename);
                		header ('Content-Transfer-Encoding: binary');
                		header("Expires: 0");
                 	header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
                 			header("Pragma: public");
                 			*/
             //print ($str);
             //exit();
             break;
             //end distribution
     }
     // end switch
     $cache = ob_get_contents();
     ob_end_clean();
     wp_cache_set($cache_id, $cache, 'bridgehouse');
     return $cache . "<!-- not cached //-->";
 }
开发者ID:jimlongo56,项目名称:bhouse,代码行数:101,代码来源:bridgehouse_prices_export_OLD.php


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