Html方式导出word 页头和页脚设置
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
xmlns="http://www.w3.org/TR/REC-html40">
<head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><title></title>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<style>
@page
{
mso-page-orientation: landscape;
size:29.7cm 21cm; margin:1cm 1cm 1cm 1cm;
}
@page Section1 {
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-header: h1;
mso-footer: f1;
}
div.Section1 { page:Section1; }
table#hrdftrtbl
{
margin:0in 0in 0in 900in;
width:1px;
height:1px;
overflow:hidden;
}
p.MsoFooter, li.MsoFooter, div.MsoFooter
{
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:center 3.0in right 6.0in;
font-size:12.0pt;
}
</style>
<xml>
<w:WordDocument>
<w:View>Print</w:View>
<w:Zoom>100</w:Zoom>
<w:DoNotOptimizeForBrowser/>
</w:WordDocument>
</xml>
</head> <body>
<div class="Section1"> <p> </p>
<br/>
<table id='hrdftrtbl' border='0' cellspacing='0' cellpadding='0'>
<tr><td> <div style='mso-element:header' id=h1 >
<!-- HEADER-tags -->
<p class=MsoHeader >HEADER</p>
<!-- end HEADER-tags -->
</div>
</td>
<td>
<div style='mso-element:footer' id=f1><span style='position:relative;z-index:-1'>
<!-- FOOTER-tags -->
FOOTER <span style='mso-no-proof:yes'><!--[if gte vml 1]><v:shapetype
id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t"
path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f">
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="Picture_x0020_1" o:spid="_x0000_s3073" type="#_x0000_t75"
alt="VHB" style='position:absolute;
margin-right:0pt;margin-top:-400pt;
z-index:-1;
visibility:visible;mso-wrap-style:square;mso-wrap-distance-left:9pt;
mso-wrap-distance-top:0;mso-wrap-distance-right:9pt;
mso-wrap-distance-bottom:0;mso-position-horizontal:absolute;
mso-position-horizontal-relative:text;mso-position-vertical:absolute;
mso-position-vertical-relative:text'>
<v:imagedata src="https://www.google.bg/logos/2012/Rodin-2012-homepage.png"/>
</v:shape><![endif]--></span>
<p class=MsoFooter>
<span style=mso-tab-count:2'></span>
Page <span style='mso-field-code: PAGE '><span style='mso-no-proof:yes'></span> from <span style='mso-field-code: NUMPAGES '></span> <!-- end FOOTER-tags -->
</span> </p>
</div> <div style='mso-element:header' id=fh1>
<p class=MsoHeader><span lang=EN-US style='mso-ansi-language:EN-US'> <o:p></o:p></span></p>
</div>
<div style='mso-element:footer' id=ff1>
<p class=MsoFooter><span lang=EN-US style='mso-ansi-language:EN-US'> <o:p></o:p></span></p>
</div> </td></tr>
</table>
</div> </body></html>
参考地址:
http://stackoverflow.com/questions/13340216/html-generated-microsoft-word-document-with-header-footer-and-watermark
需要保存为doc文件才能起作用。
Html方式导出word 页头和页脚设置的更多相关文章
- DISCUZ论坛添加页头及页尾背景图片的几种方法
先给大家分享页头添加背景图片的两种方法:1. 第一种效果,是给discuz的整体框架添加背景图片,见图示: 添加方法如下:找到你现在使用模板common文件下的header.html文件,在<h ...
- keystonejs实战之页头页脚
前两篇介绍了入门相关知识及对keystonejs整体可用性评估,这篇介绍下开始实际运用中的页头页脚部分,因为马上项目忙了,这个先匆匆的作个收尾. 不管是用WordPress还是其他CMS系统,应用最宽 ...
- C# 导出word文档及批量导出word文档(4)
接下来是批量导出word文档和批量打印word文件,批量导出word文档和批量打印word文件的思路差不多,只是批量打印不用打包压缩文件,而是把所有文件合成一个word,然后通过js来调用 ...
- RDLC打印或导出Word的 分页设置 页边距和页面大小
RDLC 导出Word的时候发现,Word的尺寸和页边距有问题,查了MSDN看到这样一段话 Page Sizing When the report is rendered, the Word page ...
- 【吉光片羽】MVC 导出Word的两种方式
1.直接将Html转成Word.MVC自带FileResult很好用.Html中我们也可以嵌入自己的样式. html: <div id="target"> <st ...
- 用XAML做网页!!—页头
原文:用XAML做网页!!-页头 接续上次进度,我们此次来制作页头. 首先要实现两侧边缘的美化,如下图所示: 在边缘处有一层朦胧的亮度反光效果,这也是通过简单的渐变实现的,而且我们在后面的每个区块中都 ...
- C# 操作Word 文档——添加Word页眉、页脚和页码
在Word文档中,我们可以通过添加页眉.页脚的方式来丰富文档内容.添加页眉.页脚时,可以添加时间.日期.文档标题,文档引用信息.页码.内容解释.图片/LOGO等多种图文信息.同时也可根据需要调整文字或 ...
- C# 添加Word页眉、页脚和页码
在Word文档中,我们可以通过添加页眉.页脚的方式来丰富文档内容.添加页眉.页脚时,可以添加时间.日期.文档标题,文档引用信息.页码.内容解释.图片/LOGO等多种图文信息.同时也可根据需要调整文字或 ...
- Lodop打印表格带页头页尾 自动分页每页显示头尾
Lodop中有两种专门给超文本表格的方式,ADD_PRINT_TABLE和ADD_PRINT_TBURL,该方式只能用于单个表格,表格外的内容不显示,是专门用于打印html超文本表格的.使用这两个语句 ...
随机推荐
- C++11右值引用
[C++11右值引用] 1.什么是左值?什么是右值? 左值是表达式结束后依然存在的对象:右值是表达式结束时就不再存在的对象. 2.std::move的作用是什么? std::move用于把任意类型转化 ...
- ThinkPad X220i 刷白名单BIOS,改装第三方无线网卡
ThinkPad X220i自带的网卡是REALTEK RTL8188CE,这张卡在Mac下目前是无解的.国外网站有该卡liunx.unix内核的驱动,但还是没有高人编译出来. 不等了,这卡没戏.正好 ...
- HDU3874Necklace(树状数组+离线操作)
此题的大意思说有一串珠子,每个珠子都有自己的欣赏值value,现在给你一串珠子每个的欣赏值,并给出一些询问,查询某个区间内部总欣赏值是多少,但是有一个约定就是如果这个区间内部有两个珠子的欣赏值是一样的 ...
- C# 固定窗体大小且不能鼠标调整大小完美实现
1.先把MaximizeBox和MinimumBox设置为false,这时你发现最大最小化按钮不见了,但是鼠标仍能调整窗体的大小. 2.有人说直接把MaximumSize和MinimumSize设置成 ...
- nginx打开目录游览功能
#开启索引功能 location / { autoindex on; autoindex_exact_size off; autoindex_localtime on; } #别名目录location ...
- xiaocms 关于搜索功能 添加搜索字段
自己折磨了好几天 就是没研究个出像样的的东西 看了一下 core/controller/index.php searchAction()方法 但是不知从何下手.查了sql语句,还是没实现 请教了一位自 ...
- UI:基础
App的生命周期 参考 多态的使用 // // main.m #import <Foundation/Foundation.h> #import "SingleDog.h&quo ...
- (剑指Offer)面试题36:数组中的逆序对
题目: 在数组中的两个数字,如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对.输入一个数组,求出这个数组中的逆序对的总数. 思路: 1.顺序扫描 顺序扫描整个数组,每扫描到一个数字,就将该数 ...
- PING的原理以及ICMP协议
主要内容: 1.ping的原理以及工作过程 2.ICMP协议 3.ICMP的应用:ping,traceroute 1.ping的原理以及工作过程 ping的原理 ping 程序是用来探测主机到主机 ...
- fastJson泛型如何转换
引子 现在负责的业务 和 json 打交道比较多, 最近使用fastJson框架 json串转成泛型对象遇到了一个异常 : java.lang.ClassCastException 还原下场景 : 模 ...