php生成word文档更改页面

标签 php mysql ms-word

我正在尝试从 php+mysql 生成单词。我找到了生成它的代码,并且有 3 个查询。我想在每个循环中更改页面。那可能吗?现在我正在使用<hr>将其分开。在示例中,我只有 2 个大循环,但在我的页面中,我有 10 个循环,并且我想要 1 个单词中的 1 个循环。这是我的代码

<?php
header("Content-type: application/vnd.ms-word");

header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; Filename=printorders.doc");

?> 

<?php 
include 'connection.php';
$result = $connection->query('SELECT * FROM main WHERE  (orderid = "100000002" OR orderid = "100000003") GROUP BY orderid ORDER BY orderid'); ?>


<?php   while($row = $result->fetch_array()) { 


    $result3 =  $connection->query("SELECT orderid, BillingStreet, City, Region FROM main WHERE BillingTelephone = '".$row["BillingTelephone"]."' group by orderid ORDER BY  `main`.`orderdate` ASC ");
        while($row3 = $result3->fetch_assoc()) { 
            $city =  $row3["City"];
            $region = $row3["Region"];
            $address = $row3["BillingStreet"];
            $idorder = $row3["orderid"];

        }
    ?>
<table border="1" width="100%" cellpadding="10" cellspacing="0" align="center" id="tbl">
    <thead>
        <tr>
            <th>id</th>
            <th>date</th>
            <th>name</th>
        <tr>
    </thead>
    <tbody>
        <tr>
            <td style="text-align:center;"><?php echo $idorder;?></td>
            <td style="text-align:center;"><?php echo $row["insert_date"];?></td>
            <td style="text-align:center;"><?php echo $row["CustomerName"];?></td>
        </tr>
    </tbody>
</table>       

<hr style="color: #f00;background-color: #f00;height: 10px;"> <!--here i want to change page-->
<?php 
} 
?>

最佳答案

如果你想使用分页符,可以添加这一行

<br style="page-break-before: always">

关于php生成word文档更改页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33275358/

相关文章:

php - Mysql UPDATE查询,保持现有值为NULL

wordpress - 如何将 Word 表格复制到 Wordpress 所见即所得编辑器

php Mysql 将用户消息分组和排序在一起

php - 帮助理解为什么这个重写不起作用?

java - 使用 Angular 从本地值数组中获取数据不起作用

php - 执行自定义 mysql 查询和 "Error: Invalid PathExpression. Must be a StateFieldPathExpression"

Mysql从date_format中减去两天

php - 在 PHP 和 MySQL 方面需要帮助

java - 如何使用 Java 根据 wml.xsd 验证 Word 2007 文件?

excel - 如何以编程方式重新启用 MS Office 禁用文件列表中的文档