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


PHP PHPExcel_Worksheet::getHighestDataColumn方法代码示例

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


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

示例1: exportExcel

 /**
  * @param Worksheet $worksheet
  * @param array $style_h2
  * @return Worksheet
  * @throws \PHPExcel_Exception
  */
 public function exportExcel(Worksheet $worksheet, array $style_h2)
 {
     $last_row = $worksheet->getHighestDataRow();
     $last_row += 2;
     $max_col = $worksheet->getHighestDataColumn();
     $worksheet->mergeCells("A{$last_row}:{$max_col}{$last_row}");
     $worksheet->setCellValue("A{$last_row}", utf8_encode($this->getTitulo()));
     $worksheet->getStyle("A{$last_row}:{$max_col}{$last_row}")->applyFromArray($style_h2);
     $worksheet->getRowDimension($last_row)->setRowHeight(20);
     $last_row += 2;
     $worksheet->setCellValue("C{$last_row}", utf8_encode('Opción'));
     $worksheet->setCellValue("D{$last_row}", 'Votos');
     $first_row = $last_row;
     $last_row += 1;
     foreach ($this->getDatos() as $key => $dato) {
         $worksheet->setCellValue("B{$last_row}", $key + 1);
         $worksheet->setCellValue("C{$last_row}", utf8_encode($dato[0]));
         if (mb_strlen($dato[0]) > 45) {
             $worksheet->getRowDimension($last_row)->setRowHeight(27);
         }
         $worksheet->setCellValue("D{$last_row}", $dato[1]);
         $last_row++;
     }
     $last_row -= 1;
     $worksheet->getStyle("C{$first_row}:D{$last_row}")->applyFromArray($this->getEstiloTabla('center', true));
     $first_row++;
     $worksheet->getStyle("B{$first_row}:D{$last_row}")->applyFromArray($this->getEstiloTabla());
     $first_row -= 1;
     $top_chart = $first_row - 1;
     $bottom_chart = $first_row + 12;
     $chart1 = $this->getChart($first_row, $last_row, $top_chart, $bottom_chart);
     $worksheet->addChart($chart1);
     $worksheet->setCellValue("A{$bottom_chart}", "");
     return $worksheet;
 }
开发者ID:shinigamicorei7,项目名称:encuestas,代码行数:41,代码来源:HasOne.php

示例2: readRowsNumeric

 /**
  * @return array[array]
  */
 protected function readRowsNumeric(ExcelSheet $excelSheet, $minRow, $maxRow = NULL)
 {
     $data = array();
     $nullValue = NULL;
     $maxCell = h::getColumnIndex($excelSheet->getHighestDataColumn());
     $emptyRow = array_fill(0, $maxCell, $nullValue);
     foreach ($excelSheet->getRowIterator($minRow) as $rowNum => $wsRow) {
         if ($maxRow !== NULL && $rowNum > $maxRow) {
             break;
         }
         $row = array();
         foreach ($wsRow->getCellIterator() as $cell) {
             $cellIndex = h::getColumnIndex($cell->getColumn());
             $isEmpty = TRUE;
             $row[$cellIndex] = $this->readValue($cell, $isEmpty, $nullValue);
         }
         ksort($row);
         $data[$rowNum] = array_replace($emptyRow, $row);
     }
     return $data;
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:24,代码来源:SimpleImporter.php

示例3: setHeader

 protected function setHeader(PHPExcel_Worksheet $activeSheet, $headers, $rightColumn = null)
 {
     if (null === $rightColumn) {
         $rightColumn = $activeSheet->getHighestDataColumn();
     }
     $i = 8;
     foreach ($headers as $title => $value) {
         $activeSheet->setCellValue('A' . $i, $title)->setCellValue($rightColumn . $i, $value);
         $i++;
     }
     $this->formatHeader($activeSheet, 'A', '8', $rightColumn, $i - 1);
     return $rightColumn;
 }
开发者ID:kbudylov,项目名称:ttarget,代码行数:13,代码来源:ExcelReport.php

示例4: sheetIsEmpty

 /**
  * Checks to see if the sheet is empty.
  * 
  * @param \PHPExcel_Worksheet $sheet The PHPExcel sheet to check.
  * 
  * @return bool Returns TRUE if the sheet is empty, else FALSE.
  */
 private static function sheetIsEmpty(\PHPExcel_Worksheet $sheet) : bool
 {
     return $sheet->getHighestDataRow() === 1 && $sheet->getHighestDataColumn() === 'A' && $sheet->getCell('A1')->getValue() === null;
 }
开发者ID:adamblake,项目名称:parse,代码行数:11,代码来源:Xlsx.php


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