01.
<%
Option
Explicit %>
02.
<html>
03.
<head>
04.
<title>ThaiCreate.Com ASP & Word.Application</title>
05.
</head>
06.
<body>
07.
<%
08.
Dim
Wrd,WrdDoc,DocName,WTable
09.
Set
Wrd = CreateObject(
"Word.Application"
)
10.
Wrd.Application.Visible =
False
11.
DocName =
"MyDoc/MyWord.doc"
12.
13.
Set
WrdDoc = Wrd.Documents.Add()
14.
15.
Set
WTable = WrdDoc.Tables.Add(Wrd.Selection.Range, 3, 3)
16.
17.
WTable.Cell(1, 1).Range.Font.Name =
"Times New Roman"
18.
WTable.Cell(1, 1).Range.Text =
"ThaiCreate.Com 1"
19.
WTable.Cell(1, 2).Range.Font.Size = 18
20.
WTable.Cell(1, 2).Range.Bold =
True
21.
WTable.Cell(1, 2).Range.Font.Italic =
True
22.
WTable.Cell(1, 2).Range.Text =
"ThaiCreate.Com 2"
23.
WTable.Cell(2, 1).Range.ParagraphFormat.Alignment = 1
24.
25.
WTable.Cell(2, 1).Range.Font.Name =
"Arial"
26.
WTable.Cell(2, 1).Range.Font.Size = 12
27.
WTable.Cell(2, 1).Range.Bold =
False
28.
WTable.Cell(2, 1).Range.ParagraphFormat.Alignment = 2
29.
30.
WTable.Cell(3, 3).Range.Font.Name =
"Times New Roman"
31.
WTable.Cell(3, 3).Range.Font.Size = 14
32.
WTable.Cell(3, 3).Range.Bold =
True
33.
WTable.Cell(3, 3).Range.Font.Underline =
True
34.
WTable.Cell(3, 3).Range.ParagraphFormat.Alignment = 0
35.
WTable.Cell(3, 2).Range.Text =
"ThaiCreate.Com 3"
36.
37.
38.
39.
Wrd.ActiveDocument.SaveAs(Server.MapPath(DocName))
40.
Wrd.Application.Quit
41.
Set
Wrd =
Nothing
42.
43.
%>
44.
Word Created <a href=
"<%=DocName%>"
>Click here</a> to Download.
45.
</body>
46.
</html>