web 2.0

How to use ASP & Word (Word.Application) - BuiltInDocumentProperties

How to use ASP & Word (Word.Application) - BuiltInDocumentProperties This is learn/tutorial asp developers how to using ASP script Setup a Word BuiltInDocumentProperties.

ShotDev Focus:
- ASP & Setup a Word BuiltInDocumentProperties.

Example

asp_word_builtin.asp


<% OptionĀ  Explicit %>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<%
Dim Wrd,DocName
Set Wrd = CreateObject("Word.Application")
Wrd.Application.Visible = False
Wrd.Documents.Add()
DocName = "MyDoc/MyWord.doc"
With Wrd
.Selection.Font.Name = "Verdana"
.Selection.Font.Size = "25"
.Selection.Font.Bold = True
.Selection.Font.Italic = True
.Selection.TypeText "Welcome To www.ShotDev.Com"
End With

Wrd.ActiveDocument.BuiltInDocumentProperties("Title").Value = "Doc Title"
Wrd.ActiveDocument.BuiltInDocumentProperties("Subject").Value = "Doc Subject"
Wrd.ActiveDocument.BuiltInDocumentProperties("Author").Value = "Doc Author"
Wrd.ActiveDocument.BuiltInDocumentProperties("Manager").Value = "Doc Manager"
Wrd.ActiveDocument.BuiltInDocumentProperties("Company").Value = "Doc Company"
Wrd.ActiveDocument.BuiltInDocumentProperties("Category").Value = "Doc Category"
Wrd.ActiveDocument.BuiltInDocumentProperties("Application Name").Value = "Doc Application Name"
Wrd.ActiveDocument.BuiltInDocumentProperties("Keywords").Value = "Doc Keywords"
Wrd.ActiveDocument.BuiltInDocumentProperties("Comments").Value = "Doc Comments"

Wrd.ActiveDocument.SaveAs(Server.MapPath(DocName))
Wrd.Application.Quit
Set Wrd = Nothing
%>
Word Created <a href="<%=DocName%>">Click here</a> to Download.
</body>
</html>

Create a asp file and save to path root-path/myasp/

Run
http://localhost/myasp/asp_word_builtin.asp

Screenshot

ASP & Setup a Word BuiltInDocumentProperties.
.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.