如何在使用PHP从HTML创建的DOC文件中包含CSS

时间:2016-03-28 13:37:32

标签: php html css doc

生成了doc但是没有获取外部CSS文件。我正在使用.css文件,但是当我生成doc文件时,它不会添加CSS类。

我的代码:

<?php
 header("Content-type: application/vnd.ms-word");
 header("Content-Disposition: attachment; file=yourcoolwordfile.doc");
?>


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/css/base.min.css" rel="stylesheet" type="text/css">
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/css/fancy.min.css" rel="stylesheet" type="text/css">
    <link href="<?php echo Yii::app()->request->baseUrl; ?>/css/main1.css" rel="stylesheet" type="text/css">
  </head>
  <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
  <div id="sidebar">
    <div id="outline"></div>
  </div>
  <div id="page-container">
    <div id="pf1" class="pf w0 h0" data-page-no="1">
      <div class="pc pc1 w0 h0">
        <img class="bi x0 y0 w0 h1" alt="" src="bg1.png"/>
        <div class="t m0 x1 h2 y1 ff1 fs0 fc0 sc0 ls0 ws0">my senior care roadmap</div>
        <div class="t m0 x1 h3 y2 ff1 fs1 fc1 sc0 ls0 ws0">prepared for : </div>
        <div class="t m0 x2 h2 y3 ff1 fs0 fc1 sc0 ls0 ws0"> </div>
        <div class="t m0 x3 h4 y4 ff1 fs2 fc2 sc0 ls0 ws0">© 2016 ageModern | info@agemodern.com | 888.460.0007 | </div>
        <div class="t m0 x4 h5 y5 ff1 fs3 fc0 sc0 ls0 ws0">03.26.2016</div>
        <a class="l" href="mailto:info@agemodern.com">
          <div class="d m1" style="border-style:none;position:absolute;left:287.492343px;bottom:11.789197px;width:132.096000px;height:14.712000px;background-color:rgba(255,255,255,0.000001);"></div>
        </a>
      </div>
      <div class="pi" data-data='{"ctm":[1.000000,0.000000,0.000000,1.000000,0.000000,0.000000]}'></div>
    </div>
  </html>

1 个答案:

答案 0 :(得分:1)

用于反映docs中的风格,excel等;我们应该在输入或HTML标记内编写css或样式。

简而言之,class.css文件无效。