aaron-bond
aaron-bond

Reputation: 3341

How can I set PHPExcel to write a file and use gridlines?

I'm trying to set up the print options for an excel file in PHPExcel. I'm working from the packaged API documents (version 1.7.7) but can't find any methods to do this. Am I missing a setting somewhere?

This setting is found in MS Excel under Print > Page Setup > Sheet.

Upvotes: 4

Views: 4628

Answers (2)

Mark Baker
Mark Baker

Reputation: 212412

$objPHPExcel->getActiveSheet()->setPrintGridlines(TRUE);

EDIT

setPrintGridlines() identifies whether gridlines around cells should be displayed when printing a worksheet from MS Excel; the default is FALSE. setShowGridlines() identifies whether gridlines around cells should be displayed when the spreadsheet is shown in the MS EXcel GUI; the default is TRUE;

Upvotes: 6

aaron-bond
aaron-bond

Reputation: 3341

I've found the one I was looking for. It was under the Worksheet class and not the page setup class as I'd previously thought. For anyone looking in future, this is the method you need:

PHPExcel_Worksheet setPrintGridlines( [boolean $pValue = false])

There are two functions very similar though: setPrintGridlines and setShowGridlines. I'm not quite sure of the difference. Can anyone enlighten me?

Upvotes: 0

Related Questions