首页 > 解决方案 > 如何在 PHP 中将 html 转换为带有图像和所有样式(css)的 word doc 文件?

问题描述

我已经经历了许多解决方案,无论我在 StackOverflow 和 Google 上都可以找到,但对我没有任何帮助文件甚至样式。

convertToWordDoc.php
<?php
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=document_name.doc");
?>
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Offer Letter</title>
</head>

<body>

  <div style="padding: 0.01em 150px;">
    <div style="display:flex !important;width:80%;margin-top:10px;">
      <img src="./assets/offer_letter_data/amosta_logo.png" style="">
      <div style="border-left:5px solid black;">Hello</div>
    </div>
  </div>


</body>

</html>

标签: javascriptphphtmlcssweb-deployment-project

解决方案


推荐阅读