You can also use EasyXLS Excel library. The pic shows me that you need to export an Excel file from database, with the cell from headers merged, borders and gray background.
This link shows you how to export data from database to Excel in PHP. It has a special section on this matter only:
http://www.easyxls.com/manual/FAQ/export-to-excel-in-php-asp.html
This link shows how to set the borders and cell background: http://www.easyxls.com/manual/basics/format-excel-cells.html
like
$xlsStyleHeader->setBackground((int)$COLOR_GRAY);
$xlsStyleHeader->setBorderColors ((int)$COLOR_GRAY, (int)$COLOR_GRAY,
(int)$COLOR_GRAY, (int)$COLOR_GRAY);
$xlsStyleHeader->setBorderStyles ($BORDER_BORDER_MEDIUM, $BORDER_BORDER_MEDIUM,
$BORDER_BORDER_MEDIUM, $BORDER_BORDER_MEDIUM);
This links shows you how to merge the cells:
http://www.easyxls.com/manual/basics/excel-merge-cells.html
like
$xlsTable = $workbook->easy_getSheet("Sheet1")->easy_getExcelTable();
$xlsTable->easy_mergeCells_2("A1:C3");