maxfx Posted December 6, 2010 Share Posted December 6, 2010 hey guys i'm new here and i cannt figure out how to get the bg color of my A5 cell in my excle file it's blue and my code always output me FFFFFF (LINE 14 in the code i paste below) ini_set('include_path', ini_get('include_path').';../Classes/'); require "PHPExcel.php"; require "PHPExcel/Writer/Excel2007.php"; $col_array = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"); $objPHPExcel = new PHPExcel(); $file = "05-2.xls"; //echo $file; $objReader = PHPExcel_IOFactory::createReaderForFile($file); $objReader->setReadDataOnly(true); $objPHPExcel = $objReader->load($file); $objWorksheet = $objPHPExcel->setActiveSheetIndex(2); $objWorksheet = $objPHPExcel->getActiveSheet(); echo $objPHPExcel->getActiveSheet()->getStyle('A5')->getFill()->getStartColor()->getRGB(); var_dump($objWorksheet->getCellByColumnAndRow('0', '5')->getValue()); die; $highestRow = $objWorksheet->getHighestRow(); // e.g. 10 $highestColumn = $objWorksheet->getHighestColumn(); // e.g 'F' $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); // e.g. 5 for ($row = 1; $row <= $highestRow; ++$row) { if ($row > 3) { for ($col = 0; $col <= $highestColumnIndex; ++$col) { $col_num = $col_array[$col]; echo $objWorksheet->getCellByColumnAndRow($col, $row)->getValue()."$col_num$row"; var_dump($objPHPExcel->getActiveSheet()->getStyle($col_num.$row)->getFill()->getStartColor()->getRGB()); $row_array[$row][] = $objWorksheet->getCellByColumnAndRow($col, $row)->getValue(); } } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.