พอดีโปรเจคที่ทำ เป็นเกี่ยวกับการโชว์ตารางสอน หลายๆตาราง(วนลูป) โชว์ในหน้าexcel
ซึ่งก็เลยมีหลายTable (ตามจำนวนloop)
แต่ปัญหาคือ ตอนที่มี 1 table ก็กำหนดความกว้าง ของ<td> ได้ตามปกตินะ
แต่พอ 2 table ขึ้นไป ก็กำหนดไม่ได้ซะงั้นเลยอยากทราบว่าพี่ๆพอจะมีวิธีแก้ไหมครับ
ปล. (ผมลองใช้ทั้งattribute width กับcss width : ... px ไปละคับ)
<?php
header("Content-Type: application/vnd.ms-excel; charset=TIS-620");
header('Content-Disposition: attachment; filename="report_schedule_teacher.xls"');#ชื่อไฟล์
?>
<html>
<head>
</head>
<body>
<table width="100%" style="border-collapse: collapse;overflow:wrap; font-size:9pt;">
<thead>
<tr>
<td width="300">Hello1</td>
<td width="400">Hello2</td>
</tr>
</thead>
<tbody>
<tr>
<td>World1</td>
<td>World2</td>
</tr>
</tbody>
</table>
<table width="100%" style="border-collapse: collapse;overflow:wrap; font-size:9pt;">
<thead>
<tr>
<td width="300">Why I cannot set width if I have multiple table</td>
<td width="400">Noooo</td>
</tr>
</thead>
<tbody>
<tr>
<td>kub</td>
<td>pom</td>
</tr>
</tbody>
</table>
</body>
</html>