Thursday 15 May 2014

html - table format when export to excel PHP -



html - table format when export to excel PHP -

i`m having issues exporting excel table php

headers somehow larger other cells.

colored cells bigger info cells, here`s table export html:

$table = "<table border='1' cellspacing='12' cellpadding='12' class='table table-bordered table-responsive statistics'>"; $currentday = ""; $currentdate = ""; if(isset($allstatistics[0][24]) && isset($allstatistics[0][10])){ $currentday = $allstatistics[0][24]; $currentdate = $allstatistics[0][10]; } foreach ($allstatistics $index => $statistic) { $debt = $debt + $statistic[7]; $payed = $payed + $statistic[8]; //print_r($statistic); if($index == 0){ $table .= "<tr><th style='font-size: 22px;background-color: #".random_color()."' colspan='9'>".$currentday." - ".$statistic[10]."</th></tr>"; $table .= "<tr><th colspan='6'></th></tr>"; } else if($statistic[10] != $currentdate){ $currentday = $statistic[24]; $currentdate = $statistic[10]; $table .= "<tr><th colspan='6'></th></tr>"; $table .= "<tr><th style='font-size: 22px;background-color: #".random_color()."' colspan='9'>".$statistic[24]." - ".$statistic[10]."</th></tr>"; $table .= "<tr><th colspan='6'></th></tr>"; } $table .= "<tr>"; $table .= "<th style='font-size: 17px;'>".$statistic[17]." ".$statistic[18]." (dni: ".$statistic[20]." ) </th>"; $table .= "<th style='font-size: 17px;'>de <strong>".$statistic[13]."</strong> <strong>".$statistic[15]."</strong></th>"; $table .= "<th style='font-size: 17px;'>".($statistic[4] == 0 ? "fijo: <strong>no</strong>" : "fijo: <strong>si</strong>")."</th>"; $table .= "<th style='font-size: 17px;'> <strong>".$statistic[24]."</strong> las ".$statistic[26]."</th>"; $table .= "<th style='font-size: 17px;'> reservado: ".$statistic[11]."</th>"; $table .= "<th style='font-size: 17px;'> debe: <strong>$".$statistic[7]."</strong>, pago: <strong>$".$statistic[8]."</strong></th>"; $table .= "</tr>"; } $table .= "<tr><th colspan='6'></th></tr>"; $table .= "<tr><th colspan='6' style='font-size: 20px;background-color: #000;color:#fff;'><span style='color: #bbb;'>se debe en total:</span> <strong>$".$debt."</strong><span style='color: #bbb;'> y se cobro en total:</span> <strong>$".$payed."</strong></th></tr>"; $table .= "</table>";

i tried colspan , whatever should work tables normally, nil seemed work.

php html excel table export

No comments:

Post a Comment