0

I am using php_writeExcel module for export data to an Excel File. I want to set background color as "White" to entire Sheet. Also Border color is White. Is there any function using which I can set White color as background color for worksheet?

Thank you!!

Khushal
  • 166
  • 1
  • 3
  • 16
  • Isn't it the default background color is white? – Raptor Jun 12 '15 at 08:27
  • yes, exactly. But Border color is black. I want it to white also. – Khushal Jun 12 '15 at 08:31
  • Similar [question](http://stackoverflow.com/questions/19397953/phpexcel-set-border-and-format-for-all-sheets-in-spreadsheet). You can use PHPExcel's default style as suggested in the question. – Raptor Jun 12 '15 at 09:09

1 Answers1

0

One closest solution I can give you is setting background color for the utilized range of the sheet (if you're data is within the vicinity of the sheet, increase the range to something like 'A1:Z100', but beware it's memory intense act)

$usedRange = $objPHPExcel->getActiveSheet(0)->calculateWorksheetDimension();
//For used data range
//$usedRange = $objPHPExcel->getActiveSheet(0)->calculateWorksheetDataDimension();
$objPHPExcel->getActiveSheet(0)->getStyle($usedRange)->applyFromArray(
    array('fill'    => array(
                                'type'      => PHPExcel_Style_Fill::FILL_SOLID,
                                'color'     => array('argb' => 'FFFFFFFF')
                            ),
         )
    );

I believe there are certain limitations when it comes to accessing entire sheet. Unlike in Excel VBA following statement may not even execute since it's swallow all your server memory which hardly takes microseconds in excel macro.

ActiveSheet.Range("A1:IV65536").Interior.ColorIndex = 13

PravyNandas
  • 607
  • 11
  • 12
  • Thanks for your reply. But you have given solution for phpExcel and I am using phpWriteExcel. This function not supported in that. – Khushal Jun 16 '15 at 11:35
  • Oh sorry. Except the syntax I believe the solution still applicable. Please give me a shot and let us here what you've achieved. – PravyNandas Jun 16 '15 at 13:07