ASP生成WORD,如何生成显示页面?

yh1025 2009-11-05 09:30:21
如题。
...全文
98 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sases 2009-11-06
  • 打赏
  • 举报
回复
guanzhu
tindy2002 2009-11-05
  • 打赏
  • 举报
回复
<%
Response.ContentType = "application/msword"
Response.AddHeader "Content-Disposition", "attachment; filename= 认可证.doc"
'Response.AddHeader "Content-Length", Str(3)
'Response.CharSet = "UTF-8"
%>
<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="http://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 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=File-List href="./04.files/filelist.xml">
<title>建设工程档案终身责任人登记表</title>
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>周震山</o:Author>
<o:LastAuthor>tindy</o:LastAuthor>
<o:Revision>2</o:Revision>
<o:TotalTime>140</o:TotalTime>
<o:LastPrinted>2004-03-12T08:19:00Z</o:LastPrinted>
<o:Created>2005-03-15T09:09:00Z</o:Created>
<o:LastSaved>2005-03-15T09:09:00Z</o:LastSaved>
<o:Pages>1</o:Pages>
<o:Words>118</o:Words>
<o:Characters>677</o:Characters>
<o:Company>景德镇市城建档案管理处</o:Company>
<o:Lines>5</o:Lines>
<o:Paragraphs>1</o:Paragraphs>
<o:CharactersWithSpaces>831</o:CharactersWithSpaces>
<o:Version>9.2812</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Print</w:View>
<w:Zoom>50</w:Zoom>
<w:PunctuationKerning/>
<w:DrawingGridHorizontalSpacing>5.25 磅</w:DrawingGridHorizontalSpacing>
<w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
<w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
<w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
<w:Compatibility>
<w:SpaceForUL/>
<w:BalanceSingleByteDoubleByteWidth/>
<w:DoNotLeaveBackslashAlone/>
<w:ULTrailSpace/>
<w:DoNotExpandShiftReturn/>
<w:FootnoteLayoutLikeWW8/>
<w:ShapeLayoutLikeWW8/>
<w:AlignTablesRowByRow/>
<w:ForgetLastTabAlignment/>
<w:LayoutRawTableWidth/>
<w:LayoutTableRowsApart/>
<w:UseFELayout/>
</w:Compatibility>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:黑体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimHei;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:1 135135232 16 0 262144 0;}
@font-face
{font-family:楷体_GB2312;
panose-1:2 1 6 9 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:modern;
mso-font-pitch:fixed;
mso-font-signature:1 135135232 16 0 262144 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@黑体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:1 135135232 16 0 262144 0;}
@font-face
{font-family:"\@楷体_GB2312";
panose-1:2 1 6 9 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:modern;
mso-font-pitch:fixed;
mso-font-signature:1 135135232 16 0 262144 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋体;
mso-font-kerning:1.0pt;}
p.MsoBodyTextIndent, li.MsoBodyTextIndent, div.MsoBodyTextIndent
{margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
text-indent:32.05pt;
line-height:200%;
mso-pagination:none;
font-size:16.0pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋体;
mso-font-kerning:1.0pt;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:42.0cm 842.0pt;
mso-page-orientation:landscape;
margin:70.9pt 70.9pt 70.9pt 70.9pt;
mso-header-margin:42.55pt;
mso-footer-margin:49.6pt;
mso-columns:2 even 21.25pt;
mso-paper-source:0;
layout-grid:15.6pt 0pt;
mso-layout-grid-char-alt:0;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="2050"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1"/>
</o:shapelayout></xml><![endif]-->
</head>

<body lang=ZH-CN style='tab-interval:21.25pt;text-justify-trim:punctuation'>
<!--#include file="../conn.asp" -->
<%
function strLength(str)
if isNull(str) or str="" then strLength = 0
Set regEx = New RegExp
regEx.Pattern = "[^\x00-\x80]"
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(str)
if not isNull(Matches) then strLength=Len(str)+Matches.Count
end function

function strLeft(str,lenum)
if strLength(str)>lenum*2 then
Dim K, newstr
K = 0
newstr = ""
Set regEx = New RegExp
regEx.Pattern = "[^\x00-\x80]"
regEx.IgnoreCase = True
regEx.Global = True
for i = 1 to Len(str)
tmpstr = Mid(str,i,1)
newstr = newstr + tmpstr
if regEx.Test(tmpstr) then K=K+2 else K=K+1
'if K=lenum*2 then Exit For
if K>=lenum*2-1 then Exit For
next
strLeft = newstr
else
strLeft = str
end if
end function

function SpaceLenStr(sVal,nLen,bCenter)
if isNull(sVal) then
SpaceLenStr = "<span style=""mso-spacerun: yes"">"& replace(Space(nLen), " ", " ") &"</span>"
else
if Not IsNumeric(sVal) then sVal = Cstr(sVal)
if strLength(sVal)>=nLen then
SpaceLenStr = sVal
else
if bCenter then
SpaceLenStr = "<span style=""mso-spacerun: yes"">"& replace(Space(Fix((nLen-strLength(sVal))/2)), " ", " ") &"</span>" & sVal & "<span style=""mso-spacerun: yes"">"& replace(Space(nLen-strLength(sVal)-Fix((nLen-strLength(sVal))/2)), " ", " ") &"</span>"
else
SpaceLenStr = sVal & "<span style=""mso-spacerun: yes"">"& replace(Space(nLen-strLength(sVal)), " ", " ") &"</span>"
end if
end if
end if
end function

obj_ID = Trim(Request("ID"))
if obj_ID="" then response.write "<B>错误的档案序列号参数,请确认你是从正确的位置进入!单击后退重新来过。</B>" : response.end

sql="select * from uca_Object"&left(Obj_ID,1)&" A inner join uca_Item"&left(Obj_ID,1)&" B on A.Obj_IteID=B.Ite_ID where obj_id="&Mid(obj_ID,2)
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,3,3
'response.write sql
if rs.eof then
response.write "此单位工程("&Obj_ID&")不存在,请确认你是从正确的位置进入!"
rs.close
set rs = nothing
conn.close
set conn = nothing
response.end
else
conn.execute("update uca_Object"&left(Obj_ID,1)&" set Obj_DocStatus=8 where obj_id="&Mid(obj_ID,2)&"")
end if

iVar=split(cstr(rs("Obj_Certificate"))&".",".")
%>
<div class=Section1 style='layout-grid:15.6pt 0pt;mso-layout-grid-char-alt:
0'>

<p class=MsoNormal align=center style='text-align:center'><span
style='font-size:26.0pt;mso-bidi-font-size:12.0pt;font-family:黑体;mso-ascii-font-family:
"Times New Roman"'>工程档案验收认可证</span><span lang=EN-US style='font-size:26.0pt;
mso-bidi-font-size:12.0pt;mso-fareast-font-family:黑体'><o:p></o:p></span></p>
junshanhudazhaxi 2009-11-05
  • 打赏
  • 举报
回复
实例:asp生成WORD文档
http://hi.baidu.com/ts360500/blog/item/8ef3621f85a06b67f724e407.html
lzp4881 2009-11-05
  • 打赏
  • 举报
回复
<%
if request.querystring("action")="toWord" then
Response.ContentType="application/msword"
Response.AddHeader "content-disposition","attachment;filename=aaa.doc"
end if
%>

<html>
<body>
<table name="data" id="data" width="100%" height="25%" border="0" cellpadding="1" cellspacing="1">
<tr>
<td width="50%" align="center" bgcolor="#FFFFCC"> <strong>职务 </strong> </td>
<td width="50%" align="center" bgcolor="#FFFFCC"> <strong>职级 </strong> </td>
</tr>
</table>
<input type="button" name="out_word" onClick="location.href='?action=toWord'" value="导出到word">

</body>
</html>

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧