Home > Backend Development > PHP Tutorial > How to set the paper format when exporting word files with php?

How to set the paper format when exporting word files with php?

WBOY
Release: 2016-10-22 00:14:18
Original
1562 people have browsed it

<code>header('Content-type: application/octet-stream');
header("Content-Disposition: attachment; filename=\"路浩内部电话表.doc\"");</code>
Copy after login
Copy after login

?>

<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>
Copy after login
Copy after login

The effect after running the exported file is as shown below:
How to set the paper format when exporting word files with php?
Now I want the following effect, that is, set it to paper format. What should be done?
How to set the paper format when exporting word files with php?

Reply content:

<code>header('Content-type: application/octet-stream');
header("Content-Disposition: attachment; filename=\"路浩内部电话表.doc\"");</code>
Copy after login
Copy after login

?>

<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>
Copy after login
Copy after login

The effect after running the exported file is as shown below:
How to set the paper format when exporting word files with php?
Now I want the following effect, that is, set it to paper format. What should be done?
How to set the paper format when exporting word files with php?

This is an empty doc template. All forms and other contents are written by yourself?
This seems to be able to make a doc template. Then write the variable name in the content of the table and then write the data. You can check for details

How to set the paper format when exporting word files with php?

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template