How to manipulate query results and cell formatting when looping thru MySQL results in PHPExcel?

Topics: Developer Forum, User Forum
Mar 10, 2015 at 2:16 AM
Edited Mar 10, 2015 at 2:28 AM
PHP v5.5.11
PHPExcel v1.8.0, 2014-03-02
Windows 8.1 Pro x64
XAMPP 1.8.3

I am facing an issue with using PHPExcel to manipulate cell formatting and query results while looping through MySQL query results, using a do-while loop and using fetch_assoc() method. When I attempt to read the next line that has a different cell value for a specific column from previous row, I was not able to push that row to the next and manipulate the current row.

PHP code is too long to post here, so I will link here: URL

My end result ended up like this, it appears that the next row meant to be pushed down is repeated across the "manipulated" row:

I am not sure is it because of the algorithm used for comparing rows that needs work or is it that I need to change the way the query results are being read prior to printing.