Error creating Excel file with PHPExcel

1

I would like to know the correct way to align the text in all columns; adjust the width of all columns; and, also apply bold in cell ranges.

The way my code is, it does correctly, however, it generates the error below:

  

PHP Notice: Undefined index:: in /home/menqcom1/public_html/php-excel/PHPExcel/Cell.php on line 820

//Mescla as celulas do titulo
$objPHPExcel->getActiveSheet()->mergeCells('A1:D1');

//Alinha o texto a Esquerda
$objPHPExcel->getActiveSheet()->getStyle('A1:E999')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);

// Definir a largura de todas as colunas    
$objPHPExcel->getActiveSheet()->getColumnDimension('A:Z')->setWidth(10);

// Formatar o intervalo A2:E3 a itálico
$objPHPExcel->getActiveSheet()->getStyle('A3:E3')->getFont()->setItalic(true);

// Formatar a cor do texto da célula A2 a azul
$objPHPExcel->getActiveSheet()->getStyle('A3:E3')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_BLUE);

// Indicação da criação do ficheiro
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');

// Formatar o intervalo A1:F1 a negrito
$objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true);
    
asked by anonymous 11.08.2017 / 05:46

0 answers