实例:asp生成WORD文档

王朝asp·作者佚名  2006-11-24
宽屏版  字体: |||超大  

<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 "九八Joy ASP维护工作意见"

wApp.Selection.ParagraphFormat.Alignment = 1

rem 居 中

wApp.Selection.TypeParagraph

wApp.Selection.Font.Bold = false

wApp.Selection.TypeText "-- 飞鸟"

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 "认真落实CHINA ASP为网友解难题,办实事精神,强化运行管理,优化网络;坚持以网管为龙头,以提高接通率为重点,做好运维工作,保证全网运行安全、高效、畅通。认真落实局内六十项奋斗目标,围绕效益工程、形象工程、福利工程,开动脑筋、解放思想,以改革为动力,推动维护、服务、管理工作更上台阶。"

wapp.selection.typetext document.form1.doc1.value

wApp.Selection.TypeParagraph

rem 居 右

wApp.Selection.TypeParagraph

wApp.Selection.Font.Bold = false

wApp.Selection.TypeText "一九九九年五月"

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>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有