1,105,242 Community Members

PHPExcel default borders

Member Avatar
Tinnin
Posting Whiz in Training
210 posts since Jul 2012
Reputation Points: 8 [?]
Q&As Helped to Solve: 4 [?]
Skill Endorsements: 2 [?]
 
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.

LastMitch
Deleted Member
 
0
 

I'm trying to hide the excel grid on the screen view by making all borders in the worksheet white.

Read this regarding about borders:

http://www.craiglotter.co.za/2010/04/14/phpexcel-how-to-place-a-border-around-a-cell-range/

Member Avatar
Tinnin
Posting Whiz in Training
210 posts since Jul 2012
Reputation Points: 8 [?]
Q&As Helped to Solve: 4 [?]
Skill Endorsements: 2 [?]
 
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

Member Avatar
Tinnin
Posting Whiz in Training
210 posts since Jul 2012
Reputation Points: 8 [?]
Q&As Helped to Solve: 4 [?]
Skill Endorsements: 2 [?]
 
0
 

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

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