我有一份报告要以xls格式导出。报告以xls格式成功导出但网格线从未出现,即使我已经通过检查视图网格线复选框调整了ms excel中的一些选项,但网格线仍然没有显示任何内容。我怀疑我的php导出代码是否有问题。你能帮帮我吗?这是我的代码。
xls导出代码
<?php
$file="report.xls";
$export ='<center><h1 class="lead">CITY Chamber</h1><img src= "base_url(images/agri_logo.jpg)" width="130px" height="130px"></center>
<div id="page-wrapper">
<table class="table table-bordered table-hover table-striped tablesorter">
<tr>
<td>First Name: </td>
<td>'.$report_rows[0]->fname.'</td>
</tr>
<tr>
<td>Last Name: </td>
<td>'. $report_rows[0]->lname.'</td>
</tr>
<tr>
<td>Gender: </td>
<td>'.$report_rows[0]->gender.'</td>
</tr>
<tr>
<td>Contact Number: </td>
<td>'.$report_rows[0]->contact.'</td>
</tr>
</table>
<table class="table table-bordered table-hover table-striped tablesorter">
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped tablesorter">
<thead>
<tr>
<td colspan="2"><strong>Key Result Areas (KRA) / Program / Projects / Activities</strong></td>
<td><strong>Target</strong></td>
<td colspan="2" style="text-align:center;"><center> '.$report_rows[0]->prev_month_year.'</center></td>
<td colspan="2" ><center> '.$report_rows[0]->pres_month_year.' </center></td>
<td><strong>Total</strong></td>
</tr>
</thead>
<form id="at_report_form" method="post">
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td> '.$dropdown_brgy1[$data_reports['prev_brgy1']].' </td>
<td> '.$dropdown_brgy1[$data_reports['prev_brgy2']].' </td>
<td> '.$dropdown_brgy1[$data_reports['pres_brgy1']].' </td>
<td> '.$dropdown_brgy1[$data_reports['pres_brgy2']].' </td>
<td></td>
</tr>
<tr>
<td>1. KRA No. 1: Production Enhancement & Environment </td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td> Protection Agenda (PEEPA)</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>1.1 Support to Crop Production Enhancement </td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>1.1.1 Rice Production Self Sufficiency Program</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td><span style="margin-left:30px;">a. Provision of certified seeds</span></td>
<td>no. of bags</td>
<td>per AT</td>
<td><center> '.$data_reports['a'].'</center></td>
<td> <center>'.$data_reports['b'].'</center></td>
<td><center> '.$data_reports['c'].'</center></td>
<td> <center>'.$data_reports['d'].'</center></td>
<td><center> '.$data_reports['total_1'].'</center></td>
</tr>
<tr>
<td></td>
<td>no. of farmers</td>
<td></td>
<td><center>'.$data_reports['e'].'</center></td>
<td><center>'.$data_reports['f'].'</center></td>
<td><center>'.$data_reports['g'].'</center></td>
<td><center>'.$data_reports['h'].'</center></td>
<td><center>'.$data_reports['total_2'].'</center></td>
</tr>
<tr>
<td style="text-align:center;">Rehab Seeds</td>
<td>no. of bags</td>
<td>per AT</td>
<td><center>'.$data_reports['i'].'</center></td>
<td><center>'.$data_reports['j'].'</center></td>
<td><center>'.$data_reports['k'].'</center></td>
<td><center>'.$data_reports['l'].'</center></td>
<td><center>'.$data_reports['total_3'].'</center></td>
</tr>
<tr>
<td></td>
<td>no. of farmers</td>
<td></td>
<td><center>'.$data_reports['m'].'</center></td>
<td><center>'.$data_reports['n'].'</center></td>
<td><center>'.$data_reports['o'].'</center></td>
<td><center>'.$data_reports['p'].'</center></td>
<td><center>'.$data_reports['total_4'].'</center></td>
</tr>
<tr>
<td><span style="margin-left:30px;">b. Provision of pest control assistance</span></td>
<td>no. of kgs (ratoxin)</td>
<td>per AT</td>
<td><center>'.$data_reports['q'].'</center></td>
<td><center>'.$data_reports['r'].'</center></td>
<td><center>'.$data_reports['s'].'</center></td>
<td><center>'.$data_reports['t'].'</center></td>
<td><center>'.$data_reports['total_5'].'</center></td>
</tr>
</tbody>
</form>
</table></div></div>';
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$file");
echo $export; ?>
输出(即使我已检查网格线视图复选框,网格线也不会显示):
答案 0 :(得分:3)
使用表格标签输出html 使用
<table border=1>