We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,171 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

PHPExcel default borders

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.

2
Contributors
4
Replies
3 Days
Discussion Span
2 Months Ago
Last Updated
36
Views
Tinnin
Junior Poster
150 posts since Jul 2012
Reputation Points: 8
Solved Threads: 1
Skill Endorsements: 1

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/

LastMitch
Industrious Poster
4,177 posts since Mar 2012
Reputation Points: 132
Solved Threads: 335
Skill Endorsements: 45

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

Tinnin
Junior Poster
150 posts since Jul 2012
Reputation Points: 8
Solved Threads: 1
Skill Endorsements: 1

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

LastMitch
Industrious Poster
4,177 posts since Mar 2012
Reputation Points: 132
Solved Threads: 335
Skill Endorsements: 45

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

Tinnin
Junior Poster
150 posts since Jul 2012
Reputation Points: 8
Solved Threads: 1
Skill Endorsements: 1

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0667 seconds using 2.69MB