欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【asp中将内容生成word文档的函数】,下面是详细的分享!
asp中将内容生成word文档的函数
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>生成word文档</title>
</head>
<script language="vbscript">
sub builddoc()
On Error Resume Next
Dim wApp
Set wApp=CreateObject("Word.Application")
If Err.number > 0 Then
Alert "没法保存为Word文件,请正确安装Word97"
else
wApp.visible=True
wApp.Documents.add
wApp.Selection.TypeParagraph
wApp.Selection.Font.Bold=True
wApp.Selection.TypeText "programfan"
wApp.Selection.ParagraphFormat.Alignment=1
rem 居 中
wApp.Selection.TypeParagraph
wApp.Selection.Font.Bold=false
wApp.Selection.TypeText "-- programfan.com"
wApp.Selection.TypeParagraph
wApp.Selection.ParagraphFormat.LeftIndent=wApp.CentimetersToPoints(0)
wApp.Selection.ParagraphFormat.FirstLineIndent=wApp.CentimetersToPoints(0.72/2*2)
wApp.Selection.TypeParagraph
wApp.Selection.Font.Bold=false
wApp.Selection.ParagraphFormat.Alignment=0
wapp.selection.typetext document.form1.doc1.value
wApp.Selection.TypeParagraph
rem 居 右
wApp.Selection.TypeParagraph
wApp.Selection.Font.Bold=false
wApp.Selection.TypeText Now()
wApp.Selection.TypeParagraph
wApp.Saved=true
wapp.ActiveDocument.SaveAs "c:\a.doc"
wapp.close
end if
end sub
</script>
<body>
<form name="form1" >
<p> </p>
<p><textarea rows="8" name="doc1" cols="46"></textarea></p>
<p> </p>
<p>生成word文档<input type="button" value="生成" name="B1" onclick="builddoc()"></p>
</form>
</body>
</html>
以上所分享的是关于asp中将内容生成word文档的函数,下面是编辑为你推荐的有价值的用户互动:
相关问题:ASP生成WORD文档问题
答:Response.ContentType = "application/msword" 加上这句,,,这句是为了实现变成WORD下载并且不调用IE打开。 >>详细
相关问题:asp 如何将页面内容导入word文档
答:参考这个吧~~ >>详细
相关问题:如何在ASP中把数据库读出的数据生成Word文档,并且...
答:网上找的答案,我试过了,可行。 1 利用word生成相应的word文件,如固定格式的表格等,然后用“另存为”功能存成htm格式。 2 使用记事本等打开,可看见html源码。 3 将代码开始处的以下内容: 改为基本html代码: 4 在页面最开始处添加以下语句: ... >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
