开发者

PageBreak in converting HTML to doc and docx fromat - PHP

开发者 https://www.devze.com 2023-03-10 21:01 出处:网络
I have converted HTML to DOC format using PHP. kindly view the below screen shot. My Problem is i need to print 1st table in first page and 2nd table in second page.

I have converted HTML to DOC format using PHP.

kindly view the below screen shot.

PageBreak in converting HTML to doc and docx fromat - PHP

My Problem is i need to print 1st table in first page and 2nd table in second page.

Here is my set of code.

header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=document_name.doc");
echo $html = '<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HTML TO WORD</title>
</head>
<style type="text/css">
.table {
 page-break-after: always;
}
</style>
<body>
<table width="600" border="1">
<tr>
<td height="105">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center; font-size:30px;color:#ed6500;"><b>Title</b></td>
</tr>
<tr>
<td style="text-align:center; color:#595959;">Author:
<span style="color:#9d402b; text-decoration:underline;">Author name</span></td>
</tr>
</table>
<table width="600" border="1">
<tr>
<td>Table Of Contents</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>Category 1</td>
</tr>
<tr>
<开发者_如何学Pythontd style="padding-left:30px;">Sub Category 1</td>
</tr>
</table>
</body>
</html>';

How can this be done?

Thanks in advance...


put this where you need a page break:

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

this is working for me


Try this:

Page 1 contents:
<hr>
Page 2 contents:
<hr>
Page 3 contents:

and within CSS:

hr {
  page-break-after: always;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消