我在从PHP导出Excel表时遇到问题。
标题不知何故比其他单元格大。
有色单元格看起来比数据单元格大,这里是表格导出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 as $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> a <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> a 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>";
我尝试了colspan以及通常用于桌子的任何东西,但似乎没有任何效果。