Diagonal line

Aug 23, 2010 at 7:08 AM

Hi All,

I am new to PHPExcel, I want to have a diagonal line for one of my cell and below is the code that i have written but when i generate my excel file, the cell is empty.

$objPHPExcel->getActiveSheet()->getStyle("$col[2]$nextLine")->getBorders()->applyFromArray(
                         array(
                             'diagonal'     => array(
                                 'style' => PHPExcel_Style_Border::BORDER_THIN,
                                 'color' => array(
                                     'rgb' => '808080'
                                 )
                             )
                         )

);

 

Can anyone please help and advise? Many Thanks in Advance

Coordinator
Aug 23, 2010 at 12:47 PM

You also need to identify which diagonal your line should be along:

$objPHPExcel->getActiveSheet()->getStyle("$col[2]$nextLine")->getBorders()->applyFromArray(
            array( 'diagonal' => array( 'style' => PHPExcel_Style_Border::BORDER_THIN, 
                                        'color' => array( 'rgb' => '808080' 
                                                        ),
                                      ),
                   'diagonaldirection' => PHPExcel_Style_Borders::DIAGONAL_DOWN
                 ) 
);

Possible values for diagonaldirection are: PHPExcel_Style_Borders::DIAGONAL_DOWN, PHPExcel_Style_Borders::DIAGONAL_UP, PHPExcel_Style_Borders::DIAGONAL_BOTH or PHPExcel_Style_Borders::DIAGONAL_NONE (which is the default)

Aug 27, 2010 at 5:06 AM

Thank you so much for your help!