Script直接写文件内容到word

下面的页面实现的是直接写文件到word中,可是让大家了解word的精细控制


 1<HTML>
 2<HEAD>
 3<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb_2312-80">
 4<link rel="stylesheet" type="text/css" href="edit.css">
 5<title>保存为Word文档</title>
 6</HEAD>
 7<script language="javascript">
 8window.returnValue=0
 9
10<BODY>
11<font color="#000080"><strong><div id="strHint" align="center">数据处理中,请等待<br>
12Data processing, please wait</div></strong></font><font color="#0080C0">
13
14
15<script language="vbscript">
16
17On Error Resume Next
18
19Dim wApp
20
21Set wApp = CreateObject("Word.Application"[img]/images/wink.gif[/img]
22If Err.number > 0 Then
23Alert "没法保存为Word文件,请正确安装Word97"
24else
25wApp.visible = True 
26wApp.Documents.add
27
28wApp.Selection.TypeParagraph
29wApp.Selection.Font.Bold = True
30wApp.Selection.TypeText "九八Joy ASP维护工作意见"
31
32wApp.Selection.ParagraphFormat.Alignment = 1 
33rem 居 中
34
35wApp.Selection.TypeParagraph 
36wApp.Selection.Font.Bold = false 
37
38wApp.Selection.TypeText "-- 飞鸟"
39
40wApp.Selection.TypeParagraph 
41
42wApp.Selection.ParagraphFormat.LeftIndent = wApp.CentimetersToPoints(0)
43wApp.Selection.ParagraphFormat.FirstLineIndent = wApp.CentimetersToPoints(0.72/2*2)
44
45wApp.Selection.TypeParagraph
46wApp.Selection.Font.Bold = false
47wApp.Selection.ParagraphFormat.Alignment = 0
48
49
50wApp.Selection.TypeText "认真落实CHINA ASP为网友解难题,办实事精神,强化运行管理,优化网络;坚持以网管为龙头,以提高接通率为重点,做好运维工作,保证全网运行安全、高效、畅通。认真落实局内六十项奋斗目标,围绕效益工程、形象工程、福利工程,开动脑筋、解放思想,以改革为动力,推动维护、服务、管理工作更上台阶。" 
51wApp.Selection.TypeParagraph 
52
53rem 居 右
54wApp.Selection.TypeParagraph 
55wApp.Selection.Font.Bold = false 
56wApp.Selection.TypeText "一九九九年五月"
57wApp.Selection.TypeParagraph 
58
59end if
60
61<center><br><strong>数据处理完毕!</strong></center>
62
63<p>
64</p><div align='center'><center><input type=button class=buttonface name='cmdOK' onclick="window.returnValue=0;window.close();" value=" 确 定 " ></center></div>
65
66</BODY>
67</HTML>
68
posted @ 2006-09-18 11:51  柴火  阅读(552)  评论(0编辑  收藏  举报