当前位置: 移动技术网 > IT编程>开发语言>.net > ASP生成Word文档的又一方法

ASP生成Word文档的又一方法

2018年10月12日  | 移动技术网IT编程  | 我要评论

荒野猎人 电影天堂,3u8885航班,裴新华老公

在网上,利用asp生成word文档的方法实在不少,最常见到的方法就是利用word生成.dot的文档,再用asp向.dot文档中传递宏,这种方法虽好,但实现起来非常复杂,而且不能循环生成表格。

在实际应用中,我总结出来一种新的生成word文件的方法,生成的word文件有页眉、页角,现拿出一例与大家探讨。

 

实现:

我的解决办法,用word xp(其他版本还没有试过)制作表格,将做好的word表格转换为html文档,在用asp控制转换后html文档。

页眉、页角的解决办法,在转换带word页眉、页角的doc文档后会在转换的html文件附加一个文件夹,内有页眉、页角文件及图片,只要在html文件的相应位置改变其路径为服务器路径即可。用户打开并asp生成的word文件后,word会自动提示将这些文件保存。

看下面的word转换后的html文,我用asp加以简单控制:

<% response.contenttype = "application/msword" %>
<!-- #include file="inc/conn_open."-->
<!-- #include file="inc/transition.asp"-->
<!-- #include file="inc/check_character.asp"-->
<!-- #include file="inc/errormsg.asp"-->
<!-- #include file="inc/check_privilege.asp"-->
<!-- #include file="inc/check_logout.asp"-->
<!-- #include file="inc/system_log_action.asp"-->
<%response.buffer=false
response.expires=0
call check_logout()
call check_state()
call privilege(6)
call log_action("访问","销售编号打印","打印临时销售编号"&request("temp_id"),1)%>
%>
<html xml(标准化越来越近了)ns:v="urn:schemas-microsoft-com:vml"
xml(标准化越来越近了)ns:o="urn:schemas-microsoft-com:office:office"
xml(标准化越来越近了)ns:w="urn:schemas-microsoft-com:office:word"
xml(标准化越来越近了)ns="https://www.w3.org/tr/rec-html40";>

<head>
<meta http-equiv=content-type content="text/html; charset=gb2312">
<meta name=progid content=word.document>
<meta name=generator content="microsoft word 10">
<meta name=originator content="microsoft word 10">
<link rel=file-list href="create_doc/filelist.xml(标准化越来越近了)">
<link rel=edit-time-data href="create_doc/editdata.mso">
<link rel=ole-object-data href="create_doc/oledata.mso">
<!--[if gte mso 9]><xml(标准化越来越近了)>
 <o:documentproperties>
  <o:author>administrator</o:author>
  <o:lastauthor>administrator</o:lastauthor>
  <o:revision>34</o:revision>
  <o:totaltime>26</o:totaltime>
  <o:lastprinted>2002-11-06t05:54:00z</o:lastprinted>
  <o:created>2002-11-06t04:56:00z</o:created>
  <o:lastsaved>2002-11-06t05:55:00z</o:lastsaved>
  <o:pages>1</o:pages>
  <o:words>98</o:words>
  <o:characters>562</o:characters>
  <o:company>shine</o:company>
  <o:lines>4</o:lines>
  <o:paragraphs>1</o:paragraphs>
  <o:characterswithspaces>659</o:characterswithspaces>
  <o:version>10.2625</o:version>
 </o:documentproperties>
</xml(标准化越来越近了)><![endif]--><!--[if gte mso 9]><xml(标准化越来越近了)>
 <w:worddocument>

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网