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


PHP PHPExcel_Worksheet::getStyle方法代码示例

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


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

示例1: addTableTotal

 /**
  * Добавляет в таблицу сводные данные по отчету
  *
  * @param PHPExcel_Worksheet $activeSheet
  * @param array $reportData
  * @param $rowc
  */
 protected function addTableTotal(PHPExcel_Worksheet $activeSheet, array $reportData, $rowc)
 {
     $activeSheet->setCellValue('A' . $rowc, 'Итог')->setCellValue('E' . $rowc, $reportData['total']['debit'])->setCellValue('F' . $rowc, $reportData['total']['sum'])->setCellValue('H' . $rowc, $reportData['total']['sum_with_vat']);
     $activeSheet->getStyle('A' . $rowc . ':K' . $rowc)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'dbe5f1')), 'font' => array('bold' => true, 'color' => array('rgb' => '000000'))));
     $activeSheet->setCellValue('A' . ($rowc + 2), 'Не оплачено (без учета ндс):')->setCellValue('E' . ($rowc + 2), $reportData['total']['not_paid'])->setCellValue('A' . ($rowc + 3), 'Оплачено (без учета ндс):')->setCellValue('E' . ($rowc + 3), $reportData['total']['paid']);
     $activeSheet->getStyle('A' . ($rowc + 2) . ':E' . ($rowc + 2))->getFill()->applyFromArray(array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'f2dddc')));
     $activeSheet->getStyle('A' . ($rowc + 3) . ':E' . ($rowc + 3))->getFill()->applyFromArray(array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'eaf1dd')));
 }
开发者ID:kbudylov,项目名称:ttarget,代码行数:15,代码来源:ExcelReportBillingWithdrawal.php

示例2: buildFooter

 private function buildFooter()
 {
     $column_index = 0;
     foreach ($this->responseTableView->getFooterData() as $footer) {
         $column_name = Utility::getNameFromNumber($column_index++);
         $this->sheet->setCellValue($column_name . $this->row_index, $footer);
         $this->sheet->getStyle($column_name . $this->row_index)->getFont()->setBold(true);
     }
 }
开发者ID:sensorsix,项目名称:app,代码行数:9,代码来源:ResponseExcelExporter.class.php

示例3: buildHead

 private function buildHead()
 {
     $column_index = 1;
     foreach ($this->analyze->getCriteriaNames() as $criterion_name) {
         $column_name = Utility::getNameFromNumber($column_index++);
         $this->sheet->setCellValue($column_name . $this->row_index, $criterion_name);
         $this->sheet->getColumnDimension($column_name)->setWidth(30, 0);
         $this->sheet->getStyle($column_name . $this->row_index)->getFont()->setBold(true);
     }
     $this->row_index++;
 }
开发者ID:sensorsix,项目名称:app,代码行数:11,代码来源:AlternativesExcelExporter.class.php

示例4: 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

示例5: addTransactionPage

 private function addTransactionPage(PHPExcel_Worksheet $activeSheet)
 {
     $activeSheet->setTitle('Транзакции')->setCellValue('A12', 'Статус')->setCellValue('B12', 'Тип')->setCellValue('C12', 'ID')->setCellValue('D12', 'Дата')->setCellValue('E12', 'IP')->setCellValue('F12', 'ГЕО')->setCellValue('G12', 'URL цели')->setCellValue('H12', 'Источник')->setCellValue('I12', 'Материал')->setCellValue('J12', 'Выплата')->setCellValue('K12', 'Вознаграждение')->setCellValue('L12', 'Зароботок')->setCellValue('M12', 'Цель');
     $row = 13;
     $availableStatuses = ActionsLog::getAvailableStatuses();
     foreach ($this->transactionData['rows'] as $tr) {
         $activeSheet->setCellValue('A' . $row, $availableStatuses[$tr['status']])->setCellValue('B' . $row, $tr['source_type_name'])->setCellValue('C' . $row, $tr['id'])->setCellValue('D' . $row, Yii::app()->dateFormatter->formatDateTime($tr['date']))->setCellValue('E' . $row, $tr['ip'])->setCellValue('F' . $row, $tr['geo'])->setCellValue('G' . $row, $tr['target_url_decoded'])->setCellValue('H' . $row, $tr['source_name'])->setCellValue('I' . $row, $tr['target_name'])->setCellValue('J' . $row, $tr['payment'])->setCellValue('K' . $row, $tr['reward'])->setCellValue('L' . $row, $tr['debit'])->setCellValue('M' . $row, $tr['action_name']);
         $row++;
     }
     $activeSheet->setCellValue('J' . $row, $this->transactionData['total']['payment'])->setCellValue('K' . $row, $this->transactionData['total']['reward'])->setCellValue('L' . $row, $this->transactionData['total']['debit']);
     $activeSheet->getColumnDimension('A')->setWidth(16.3 * 1.05);
     $activeSheet->getColumnDimension('B')->setWidth(16.43 * 1.05);
     $activeSheet->getColumnDimension('C')->setWidth(5 * 1.05);
     $activeSheet->getColumnDimension('D')->setWidth(17.86 * 1.05);
     $activeSheet->getColumnDimension('E')->setWidth(14.14 * 1.05);
     $activeSheet->getColumnDimension('F')->setWidth(34 * 1.05);
     $activeSheet->getColumnDimension('G')->setWidth(31 * 1.05);
     $activeSheet->getColumnDimension('H')->setWidth(30.86 * 1.05);
     $activeSheet->getColumnDimension('I')->setWidth(19.14 * 1.05);
     $activeSheet->getColumnDimension('J')->setWidth(8.57 * 1.05);
     $activeSheet->getColumnDimension('K')->setWidth(8.57 * 1.05);
     $activeSheet->getColumnDimension('L')->setWidth(8.57 * 1.05);
     $activeSheet->getColumnDimension('M')->setWidth(30.7 * 1.05);
     $activeSheet->getStyle('A12:M' . $row)->getAlignment()->setWrapText(true);
     $this->formatTable($activeSheet, 'A', '12', 'M', $row, array('formatTotal' => true, 'innerRowHeight' => -1, 'headerRowHeight' => 27));
     $this->addLogo($activeSheet);
     $this->setHeader($activeSheet, $this->getHeaders());
     $this->setPageFit($activeSheet, self::FIT_TO_WIDTH, PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
 }
开发者ID:kbudylov,项目名称:ttarget,代码行数:29,代码来源:ExcelReportTransactions.php

示例6: formatSums

 /**
  * format the sums row if there are any sums
  * (borders and background color)
  */
 protected function formatSums()
 {
     if (!$this->anySumsWereAdded) {
         return;
     }
     $this->sheet->getStyle(self::excelRange(0, self::EXCEL_HEADER_OFFSET + count($this->exportData_arr), count($this->activeColumns_arr) - 1, self::EXCEL_HEADER_OFFSET + count($this->exportData_arr)))->applyFromArray(array('font' => array('bold' => 'true'), 'borders' => array('outline' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('argb' => 'FF000000')))));
     $this->sheet->getStyle(self::excelRange(0, self::EXCEL_HEADER_OFFSET + count($this->exportData_arr), count($this->activeColumns_arr) - 1, self::EXCEL_HEADER_OFFSET + count($this->exportData_arr)))->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FFEEEEEE');
 }
开发者ID:kimai,项目名称:kimai,代码行数:12,代码来源:ExcelExporter.php

示例7: writeDCStatsLine

/**
 * Write one line of the data center statistics
 *
 * @param PHPExcel_Worksheet $worksheet
 * @param string $style
 * @param array $wsProps
 * @param integer $rownum
 * @param array $DCStatsSum
 */
function writeDCStatsLine($worksheet, $style, $wsProps, $rownum, $DCStatsSum)
{
    $worksheet->fromArray($DCStatsSum, null, 'A' . $rownum);
    $lastCol = count($DCStatsSum) - 1;
    $range = 'A' . $rownum . ':' . PHPExcel_Cell::stringFromColumnIndex($lastCol) . $rownum;
    switch ($style) {
        case 'Total':
            $worksheet->getStyle($range)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
            $worksheet->getStyle($range)->getFill()->getStartColor()->setRGB($wsProps['FillColor']);
            $worksheet->getStyle($range)->getFont()->getColor()->setRGB($wsProps['HeadingFontColor']);
        case 'SummaryLine':
            $worksheet->getStyle($range)->getFont()->setBold(true);
            $worksheet->getStyle($range)->applyFromArray($wsProps['Border Style']);
    }
}
开发者ID:dc-admin,项目名称:openDCIM,代码行数:24,代码来源:report_asset_Excel-new.php

示例8: _generateRow

 /**
  * Generate row
  *
  * @param	PHPExcel_Worksheet 	$pSheet			PHPExcel_Worksheet
  * @param	array				$pValues		Array containing cells in a row
  * @param	int					$pRow			Row number
  * @return	string
  * @throws	Exception
  */
 private function _generateRow(PHPExcel_Worksheet $pSheet, $pValues = null, $pRow = 0)
 {
     if (is_array($pValues)) {
         // Construct HTML
         $html = '';
         // Sheet hashcode
         $sheetHash = $pSheet->getHashCode();
         // Write row start
         if (!$this->_useInlineCss) {
             $html .= '        <tr class="row' . $pRow . '">' . "\r\n";
         } else {
             $style = isset($this->_cssStyles['table.sheet' . $sheetHash . ' tr.row' . $pRow]) ? $this->_cssStyles['table.sheet' . $sheetHash . ' tr.row' . $pRow] : '';
             $html .= '        <tr style="' . $style . '">' . "\r\n";
         }
         // Write cells
         $colNum = 0;
         foreach ($pValues as $cell) {
             $cellData = '&nbsp;';
             $cssClass = '';
             if (!$this->_useInlineCss) {
                 $cssClass = 'column' . $colNum;
             } else {
                 $cssClass = isset($this->_cssStyles['table.sheet' . $sheetHash . ' td.column' . $colNum]) ? $this->_cssStyles['table.sheet' . $sheetHash . ' td.column' . $colNum] : '';
             }
             $colSpan = 1;
             $rowSpan = 1;
             $writeCell = true;
             // Write cell
             // PHPExcel_Cell
             if ($cell instanceof PHPExcel_Cell) {
                 // Value
                 if ($cell->getValue() instanceof PHPExcel_RichText) {
                     // Loop trough rich text elements
                     $elements = $cell->getValue()->getRichTextElements();
                     foreach ($elements as $element) {
                         // Rich text start?
                         if ($element instanceof PHPExcel_RichText_Run) {
                             $cellData .= '<span style="' . str_replace("\r\n", '', $this->_createCSSStyleFont($element->getFont())) . '">';
                             if ($element->getFont()->getSuperScript()) {
                                 $cellData .= '<sup>';
                             } else {
                                 if ($element->getFont()->getSubScript()) {
                                     $cellData .= '<sub>';
                                 }
                             }
                         }
                         // Convert UTF8 data to PCDATA
                         $cellText = $element->getText();
                         $cellData .= htmlspecialchars($cellText);
                         if ($element instanceof PHPExcel_RichText_Run) {
                             if ($element->getFont()->getSuperScript()) {
                                 $cellData .= '</sup>';
                             } else {
                                 if ($element->getFont()->getSubScript()) {
                                     $cellData .= '</sub>';
                                 }
                             }
                             $cellData .= '</span>';
                         }
                     }
                 } else {
                     if ($this->_preCalculateFormulas) {
                         $cellData = PHPExcel_Style_NumberFormat::toFormattedString($cell->getCalculatedValue(), $pSheet->getstyle($cell->getCoordinate())->getNumberFormat()->getFormatCode());
                     } else {
                         $cellData = PHPExcel_Style_NumberFormat::ToFormattedString($cell->getValue(), $pSheet->getstyle($cell->getCoordinate())->getNumberFormat()->getFormatCode());
                     }
                     // Convert UTF8 data to PCDATA
                     $cellData = htmlspecialchars($cellData);
                 }
                 // Check value
                 if ($cellData == '') {
                     $cellData = '&nbsp;';
                 }
                 // Extend CSS class?
                 if (array_key_exists($cell->getCoordinate(), $pSheet->getStyles())) {
                     if (!$this->_useInlineCss) {
                         $cssClass .= ' style' . $pSheet->getStyle($cell->getCoordinate())->getHashIndex();
                         $cssClass .= ' ' . $cell->getDataType();
                     } else {
                         $cssClass .= isset($this->_cssStyles['style' . $pSheet->getStyle($cell->getCoordinate())->getHashIndex()]) ? $this->_cssStyles['style' . $pSheet->getStyle($cell->getCoordinate())->getHashIndex()] : '';
                         // General horizontal alignment: Actual horizontal alignment depends on dataType
                         if ($pSheet->getStyle($cell->getCoordinate())->getAlignment()->getHorizontal() == PHPExcel_Style_Alignment::HORIZONTAL_GENERAL && isset($this->_cssStyles['.' . $cell->getDataType()])) {
                             if (preg_match('/text-align: [^;]*;/', $cssClass)) {
                                 $cssClass = preg_replace('/text-align: [^;]*;/', $this->_cssStyles['.' . $cell->getDataType()], $cssClass);
                             } else {
                                 $cssClass .= $this->_cssStyles['.' . $cell->getDataType()];
                             }
                         }
                     }
                 }
             } else {
//.........这里部分代码省略.........
开发者ID:roelvanduijnhoven,项目名称:muzieklijstjes,代码行数:101,代码来源:HTML.php

示例9: setBorderStyle

 protected function setBorderStyle(\PHPExcel_Worksheet $phpExcelSheet, $fromCode, $toCode, $rowLength, $color)
 {
     $borderStyle = ['borders' => ['inside' => ['style' => \PHPExcel_Style_Border::BORDER_THIN, 'color' => ['argb' => $color]], 'outline' => ['style' => \PHPExcel_Style_Border::BORDER_THIN, 'color' => ['argb' => $color]]]];
     $phpExcelSheet->getStyle($fromCode . '1:' . $toCode . $rowLength)->applyFromArray($borderStyle);
 }
开发者ID:ashmna,项目名称:MedDocs,代码行数:5,代码来源:ExportData.php

示例10: acompanhamento

 /**
  * Método que gera a planilha de acompnahamento do livro e disciplinas informadas
  * @param int $livro O código do livro
  * @param int $materia O código da máteria
  */
 public function acompanhamento()
 {
     //Inicializando os filtros usados na página
     $this->filtro->initGets(array("livro", "disciplina"));
     //Inicializando os objeto básicos
     $sqlTopico = new SqlTopico();
     //Buscando os tópicos
     $topicosLista = $sqlTopico->listarTodos($this->filtro);
     //Verificando se o livro é válido
     if (!$topicosLista->rowCount()) {
         echo Javascript::alert("Não foi encontrado conteúdo " . "associado ao livro e disciplina informados");
         die(Javascript::close());
     }
     $topicos = $topicosLista->fetchAll();
     //Array com os contepudos do livro
     //
     $topicoInicia = $topicos[0];
     //Primeiro item do array com os dados básicos
     //Variáveis iniciais básicas
     $xBase = 1;
     //Coluna inicial da impressão
     $yBase = 1;
     //Linha de início da impressão
     $nColunasCapitulos = 5;
     //Número de colunas da culuna inicial
     $nColunasPaginas = 1;
     //Número de colunas da culuna de páginas
     $nColunasAulas = 10;
     //Número de colunas referentes ao número máximo de aulas
     $nColunasMax = 0;
     //Define o número máximo de colunas da planilha
     $indiceUltColuna = 0;
     //Define o indice da ultima coluna da planilha
     $colecao = $topicoInicia->getCapitulo()->getLivro()->getColecao()->getNome();
     //Nome da coleção a qual o livro pertence
     $tituloPlanilha = "PLANILHA DE ACOMPANHAMENTO PROGRAMÁTICO ({$this->data["ano_letivo"]})";
     $textoAula = "Aula ";
     //Define o texto das celulas "aula"
     $textoData = "Data:";
     //Define o texto das celulas "data"
     $alturaLinha = 40;
     //Define a autura minima das linhas
     $larguraLegenda = 5;
     //Define a largura de cada coluna das legendas em pixels
     $textoPaguinas = "PÁGINAS";
     //Define o texto da coluna de páginas
     $textoPaguinasVertical = FALSE;
     //Define se o texto sobre a coluna páginas ficará na vertical ou não
     //Coluna da esquerda
     $arrayExplicativo = array("Preenchimento", "O status do andamento dos assuntos do livro da coleção {$colecao} " . "deve ser atualizado a cada aula ministrada pelo professor, " . "independente se na aula foi utilizado ou não o livro didático.");
     $arrayDadosProfessor = array("PROFESSOR:", "", "", "SÉRIE:", "TURMA:", "UNIDADE:");
     //Coluna da direita
     $arrayDadosLivro = array("", "{$topicoInicia->getCapitulo()->getLivro()->getTitulo()} ({$topicoInicia->getSequencial()} º Bimestre)", $topicoInicia->getCapitulo()->getDisciplina()->getNome(), "Livro Didático: {$topicoInicia->getCapitulo()->getLivro()->getTitulo()}", "");
     $arrayColunaAulaData = array($textoAula, $textoData, "");
     //
     $arrayLegenda = array("A" => "EM ANDAMENTO", "C" => "CONCLUÍDO", "R" => "REVISADO");
     //Início da execução
     //Verificação de erros de configuração
     if (count($arrayExplicativo) + count($arrayDadosProfessor) != count($arrayDadosLivro) + count($arrayColunaAulaData)) {
         //As somas de itens entre os pares de arrays acima devem ser iguais
         die("Planilha mal configurada");
     }
     //Variaveis dinâmicas usadas na execução
     $x = $xBase;
     $y = $yBase + 1;
     $nColunasMax += $xBase + $nColunasCapitulos + $nColunasPaginas + $nColunasAulas * count($arrayLegenda);
     $indiceUltColuna += $xBase + $nColunasMax;
     //Inserindo os dados na planilha
     //
     $this->workSheet->setCellValueByColumnAndRow($x, $y, $tituloPlanilha);
     $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
     $this->workSheet->getStyleByColumnAndRow($x, $y)->getFont()->setSize(20);
     $this->workSheet->getStyle(ExcelAux::indiceParaColuna($x + 1) . $y . ":" . ExcelAux::indiceParaColuna($indiceUltColuna + 1) . $y)->applyFromArray(array("font" => array("bold" => TRUE), "borders" => array("top" => array("style" => PHPExcel_Style_Border::BORDER_MEDIUM, "color" => array("argb" => "000000")), "left" => array("style" => PHPExcel_Style_Border::BORDER_MEDIUM, "color" => array("argb" => "000000")), "right" => array("style" => PHPExcel_Style_Border::BORDER_MEDIUM, "color" => array("argb" => "000000")), "bottom" => array("style" => PHPExcel_Style_Border::BORDER_THIN, "color" => array("argb" => "000000")))));
     $this->workSheet->mergeCellsByColumnAndRow($x, $y, $indiceUltColuna, $y);
     $this->workSheet->getRowDimension($y++)->setRowHeight($alturaLinha);
     //Variaveis de indices e contadores
     $linhaExpl = 0;
     $linhaProf = 0;
     $linhaLivro = 0;
     $linhaAulaData = 0;
     $colunaLegenda = 0;
     $colunaLegendaChave = array_keys($arrayLegenda);
     foreach (range(0, count($arrayExplicativo) + count($arrayDadosProfessor) - 1) as $value) {
         $x = $xBase;
         //Preenchendo a coluna da esquerda
         if (isset($arrayExplicativo[$linhaExpl])) {
             $this->workSheet->setCellValueByColumnAndRow($x, $y, $arrayExplicativo[$linhaExpl++]);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setWrapText(TRUE);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getFont()->setSize(12);
             if ($linhaExpl == count($arrayExplicativo)) {
                 $this->workSheet->getRowDimension($y)->setRowHeight($alturaLinha + 25);
                 $this->workSheet->getStyle(ExcelAux::indiceParaColuna($xBase + 1) . $y . ":" . ExcelAux::indiceParaColuna($xBase + $nColunasCapitulos + 2) . $y)->applyFromArray(array("borders" => array("bottom" => array("style" => PHPExcel_Style_Border::BORDER_THIN, "color" => array("rgb" => "000000")))));
             }
//.........这里部分代码省略.........
开发者ID:andersongimino,项目名称:area51,代码行数:101,代码来源:planilhas.php

示例11: addChart1

 private function addChart1(\PHPExcel $ea, \PHPExcel_Worksheet $ews)
 {
     //The below line should be moved into addAnalysis but we move this here to show that $ews is actually referring to the sheet
     $ews->getStyle('b4')->getNumberFormat()->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE);
     $title = new \PHPExcel_Chart_Title($ews->getTitle());
     // Set the data serie labels
     $dsl = array(new \PHPExcel_Chart_DataSeriesValues('String', 'Summary!A1', NULL, 1));
     // Set X-Axis Labels
     $xal = array(new \PHPExcel_Chart_DataSeriesValues('String', 'Summary!A2:A3', NULL, 2));
     // Set data serie values
     $dsv = array(new \PHPExcel_Chart_DataSeriesValues('Number', 'Summary!B2:B3', NULL, 2));
     // Build a dataserie
     $ds = new \PHPExcel_Chart_DataSeries(\PHPExcel_Chart_DataSeries::TYPE_PIECHART, null, range(0, count($dsv) - 1), $dsl, $xal, $dsv);
     // A layout for the Pie Chart
     $layout = new \PHPExcel_Chart_Layout();
     $layout->setShowVal(true);
     $layout->setShowPercent(true);
     // Set series in the plot area
     $pa = new \PHPExcel_Chart_PlotArea($layout, array($ds));
     // Set legend
     $legend = new \PHPExcel_Chart_Legend(\PHPExcel_Chart_Legend::POSITION_RIGHT, NULL, false);
     //Create Chart
     $chart = new \PHPExcel_Chart('chart1', $title, $legend, $pa, true, 0, NULL, NULL);
     $chart->setTopLeftPosition('K1');
     $chart->setBottomRightPosition('U30');
     $ews->addChart($chart);
 }
开发者ID:putheakhem,项目名称:phpexcel,代码行数:27,代码来源:classExcel.php

示例12: formatTable

 /**
  * Форматирует таблицу с данными
  *
  * @param PHPExcel_Worksheet $activeSheet
  * @param $x1
  * @param $y1
  * @param $x2
  * @param $y2
  */
 protected function formatTable(PHPExcel_Worksheet $activeSheet, $x1, $y1, $x2, $y2)
 {
     $activeSheet->getStyle($x1 . $y1 . ':' . $x2 . $y1)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => '528ed6')), 'font' => array('size' => 10, 'color' => array('rgb' => 'FFFFFF')), 'alignment' => array('wrap' => true, 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER)));
     $activeSheet->getStyle($x1 . $y1 . ':' . $x2 . $y2)->applyFromArray(array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('rgb' => '000000')))));
 }
开发者ID:kbudylov,项目名称:ttarget,代码行数:14,代码来源:ExcelReportPlatformByPeriod.php

示例13: getStyleOfCell

 private function getStyleOfCell(\PHPExcel_Worksheet $templateSheet, $templateCor)
 {
     $style = $templateSheet->getStyle($templateCor);
     $style = $style->getIsSupervisor() ? $style->getSharedComponent() : $style;
     return $style->getIndex();
 }
开发者ID:mathielen,项目名称:report-write-engine,代码行数:6,代码来源:ExcelNamedRangeTemplatePopulator.php

示例14: render

 /**
  * Inserts data into worksheet and returns it
  * 
  * @return PHPExcel_Worksheet
  */
 public function render()
 {
     // Set worksheet header
     $this->_set_row(1, $this->columns, TRUE);
     //set header style
     $obj_style = new PHPExcel_Style();
     $style = Kohana::$config->load('phpexcel.header');
     $obj_style->applyFromArray($style);
     $column_dim = PHPExcel_Cell::stringFromColumnIndex(count($this->columns) - 1);
     $this->_worksheet->setSharedStyle($obj_style, 'A1:' . $column_dim . '1');
     // Set data
     $rows = 0;
     foreach ($this->data as $row => $data) {
         $this->_set_row($row + 2, $data);
         $rows++;
     }
     // Set column styles and width
     $column = 0;
     foreach (array_keys($this->columns) as $key) {
         $column_dim = PHPExcel_Cell::stringFromColumnIndex($column);
         $format = Arr::get($this->formats, $key);
         if ($format !== NULL) {
             $this->_worksheet->getStyle($column_dim . 2 . ':' . $column_dim . (2 + $rows))->getNumberFormat()->setFormatCode($format);
         }
         if ($this->auto_size === TRUE) {
             $this->_worksheet->getColumnDimension($column_dim)->setAutoSize(TRUE);
         }
         $column++;
     }
     return $this->_worksheet;
 }
开发者ID:efremovich,项目名称:kohana-phpexcel,代码行数:36,代码来源:Worksheet.php

示例15: headerRow

 /**
  * Add an header row to a {@link PHPExcel_Worksheet}.
  * @param  PHPExcel_Worksheet $sheet
  * @param  array              $fields List of fields
  * @return PHPExcel_Worksheet
  */
 protected function headerRow(PHPExcel_Worksheet &$sheet, array $fields)
 {
     // Counter
     $row = 1;
     $col = 0;
     // Add each field to the first row
     foreach ($fields as $field => $type) {
         $sheet->setCellValueByColumnAndRow($col, $row, $field);
         $col++;
     }
     // Get the last column
     $col--;
     $endcol = PHPExcel_Cell::stringFromColumnIndex($col);
     // Set Autofilters and Header row style
     $sheet->setAutoFilter("A1:{$endcol}1");
     $sheet->getStyle("A1:{$endcol}1")->getFont()->setBold(true);
     return $sheet;
 }
开发者ID:helpfulrobot,项目名称:firebrandhq-silverstripe-excel-export,代码行数:24,代码来源:ExcelDataFormatter.php


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