There might be a situation where you want to generate an in-memory image using GD and add it to a PHPExcel worksheet without first having to save this file to a temporary location.
Here’s an example which generates an image in memory and adds it to the active worksheet:
// Generate an image
$gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream');
Sometimes you want to set a color for sheet tab. For example you can have a red sheet tab:
$objWorksheet->getTabColor()->setRGB('FF0000');
Creating worksheets in a workbook
If you need to create more worksheets in the workbook, here is how:
$objWorksheet1 = $objPHPExcel->createSheet();
$objWorksheet1->setTitle('Another sheet');
Think of createSheet() as the "Insert sheet" button in Excel. When you hit that button a new sheet is appended to the existing collection of worksheets in the workbook.
Sometimes you may even want the worksheet to be “very hidden”. The available sheet states are :
PHPExcel_Worksheet::SHEETSTATE_VISIBLE
PHPExcel_Worksheet::SHEETSTATE_HIDDEN
PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN
In Excel the sheet state “very hidden” can only be set programmatically, e.g. with Visual Basic Macro. It is not possible to make such a sheet visible via the user interface.
Right-to-left worksheet
Worksheets can be set individually whether column ‘A’ should start at left or right side. Default is left. Here is how to set columns from right-to-left.