1.11M Members

PHPExcel default borders

 
0
 

I'm trying to hide the excel grid on the screen view by making all borders in the worksheet white. I can't figure out how to get it working though.

My attempts so far:

$objPHPExcel->getDefaultStyle()->applyFromArray(array(
            'borders' => array(
                'allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN,
                                      'color' => array('rgb' => PHPExcel_Style_Color::COLOR_WHITE)
                                      )
            )
        ));

and

$objPHPExcel->getDefaultStyle()->applyFromArray(array(
            'borders' => array(
                'top' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 
                                      'color' => array('rgb' => PHPExcel_Style_Color::COLOR_WHITE)
                                      ),
                'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 
                                      'color' => array('rgb' => PHPExcel_Style_Color::COLOR_WHITE)
                                      ),
                'left' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 
                                      'color' => array('rgb' => PHPExcel_Style_Color::COLOR_WHITE)
                                      ),
                'right' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 
                                      'color' => array('rgb' => PHPExcel_Style_Color::COLOR_WHITE)
                                      )
            )
        ));

I can't see where I'm going wrong.

Thanks in advance for any help offered.

 
0
 

Thanks LastMitch. This just mentions how to apply borders to a range though. I want to apply it to every cell in the worksheet.

LastMitch
Deleted Member
 
0
 

Thanks LastMitch. This just mentions how to apply borders to a range though. I want to apply it to every cell in the worksheet.

You never mention that you want to apply borders on all worksheets. You just want to apply a sheet.

I don't think you can used the array to do that.

I think you have to create __construct function.

Read this link, it has a function that you call and apply to all sheets:

http://www.phpkode.com/source/p/phpexcel/Classes/PHPExcel/Style/Borders.php

 
0
 

Thanks LastMitch. I'll have a look at that.

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article