web 2.0

How to use ASP & Word (Word.Application) - Page Setup

How to use ASP & Word (Word.Application) - Create Word Document This is learn/tutorial asp developers how to using ASP script Setup a page in word document.

ShotDev Focus:
- ASP & Setup a page in word document.

Example

asp_word_pagesetup.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.PageSetup.LeftMargin = "0.25"
.Selection.PageSetup.RightMargin = "0.25"
.Selection.PageSetup.TopMargin = "0.25"
.Selection.PageSetup.BottomMargin = "0.25"
.Selection.TypeText "Welcome To www.ShotDev.Com"
End With

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_pagesetup.asp

Screenshot

ASP & Setup a page in word document.
.
.
.
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 ...

One Response to “How to use ASP & Word (Word.Application) - Page Setup”

  1. 2debater…

Leave a Reply

You must be logged in to post a comment.