PHPExcel read styles

Topics: Developer Forum
Nov 17, 2010 at 9:34 AM
Edited Nov 17, 2010 at 10:16 AM

I am using PHPExcel to read xlsx-files into an array (data and styles).
The data is no problem, but I have issues with the styles.

I base my style-properties on the getSharedComponent() function. This is my code:

$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objExcel = $objReader->load($bestand);
$objSheet = $objExcel->getActiveSheet();
$rijarray = $objSheet->getRowIterator();
foreach($rijarray as $rij)
	$celarray = $rij->getCellIterator();
	$rijindex = $rij->getRowIndex();
	$y = $rijindex - 1;
	foreach($celarray as $cel)
		$kolomindex = $cel->getColumn();
		$x = (PHPExcel_Cell::ColumnIndexFromString($kolomindex)) - 1;
		$data[$y][$x]['data'] = trim($cel->getCalculatedValue());
		$objStyle = $objSheet->getStyle($kolomindex.$rijindex)->getSharedComponent();
		$data[$y][$x]['style'] = object2array($objStyle, "PHPExcel");

(The object2array() function is a function that I wrote to convert the object to a dimensional array).

The problem: I noticed that color properties don't convert there properties like in the Excelfile.

Is this a known issue in PHPExcel or do I have to load the styles in another way?