[英]How to include CSS in a DOC file created from HTML using PHP
The doc is generated but it's not getting the external CSS file.文档已生成,但未获取外部 CSS 文件。 I am using .css files but when I generate the doc file it's not adding the CSS classes.
我正在使用 .css 文件,但是当我生成 doc 文件时,它没有添加 CSS 类。
My code:我的代码:
<?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>
For reflecting the style in docs, excel etc;用于反映文档、excel等中的风格; we should write the css or style inside the inputs or HTML tags.
我们应该在输入或 HTML 标签中编写 css 或样式。
In short, class
or .css
file wont work.简而言之,
class
或.css
文件不起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.