<code>header('Content-type: application/octet-stream'); header("Content-Disposition: attachment; filename=\"路浩内部电话表.doc\"");</code>
?>
<code><!DOCTYPE html> <html > <head> <meta charset="UTF-8"> <title>电话表</title> <style> th, .bm { font-family: SimHei; padding: 5px; } td { font-family: FangSong_GB2312; font-size: 14px; padding: 5px; } .num { font-family: 'Times New Roman'; font-size: 14px; padding: 5px; } </style> </head> <body> <table border="1" cellpadding="0" cellspacing="0" align="center"> <caption align="center" style="font-size:24px;padding:15px;font-family: SimHei;">内部电话表</caption> <tr> <th style="width:150px">部门</th> <th style="width:150px">职务</th> <th style="width:100px">姓名</th> <th style="width:150px">分机</th> <th style="width:150px">直拨号</th> <th style="width:150px">邮箱</th> </tr> <tr> <th style="width:150px">流程部</th> <th style="width:150px">代理人</th> <th style="width:100px">张三</th> <th style="width:150px">1827</th> <th style="width:150px">0302</th> <th style="width:150px">7129@qq.com</th> </tr> </table> </body> </html> </code>
運行匯出檔案後效果如下圖:
現在想要如下的效果,也就是設定成紙張的格式。該什麼做呢?
<code>header('Content-type: application/octet-stream'); header("Content-Disposition: attachment; filename=\"路浩内部电话表.doc\"");</code>
?>
<code><!DOCTYPE html> <html > <head> <meta charset="UTF-8"> <title>电话表</title> <style> th, .bm { font-family: SimHei; padding: 5px; } td { font-family: FangSong_GB2312; font-size: 14px; padding: 5px; } .num { font-family: 'Times New Roman'; font-size: 14px; padding: 5px; } </style> </head> <body> <table border="1" cellpadding="0" cellspacing="0" align="center"> <caption align="center" style="font-size:24px;padding:15px;font-family: SimHei;">内部电话表</caption> <tr> <th style="width:150px">部门</th> <th style="width:150px">职务</th> <th style="width:100px">姓名</th> <th style="width:150px">分机</th> <th style="width:150px">直拨号</th> <th style="width:150px">邮箱</th> </tr> <tr> <th style="width:150px">流程部</th> <th style="width:150px">代理人</th> <th style="width:100px">张三</th> <th style="width:150px">1827</th> <th style="width:150px">0302</th> <th style="width:150px">7129@qq.com</th> </tr> </table> </body> </html> </code>
運行匯出檔案後效果如下圖:
現在想要如下的效果,也就是設定成紙張的格式。該什麼做呢?
你這個是空doc範本 表格啥的都是寫入的自己?
這個好像可以做好doc模板 然後表格的內容寫變數名 然後寫入資料即可 具體你可以查查