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.

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

Member Avatar for LastMitch

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.