web 2.0

ASP.NET(vb.net) & Word (Word.Application) - Create Word Document

ASP.NET(vb.net) & Word (Word Application) - Create Word Document - This article example scripts you will learn how to Create Word Document using ASP.NET Scripts

ShotDev Focus:
- ASP.NET(vb.net) & Word (Word Application) - Create Word Document

Example

AspNetAspWriteWord.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="AspNetAspWriteWord.aspx.vb" Inherits="AspNetAspWriteWord" %>
<html>
<head runat="server">
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="lblText" runat="server"></asp:Label>
</form>
</body>
</html>

AspNetAspWriteWord.aspx.vb


Imports Microsoft.Office.Interop.Word
Public Class AspNetAspWriteWord
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim Wrd As New Microsoft.Office.Interop.Word.Application
Dim DocName As String = "MyDoc/MyWord.doc"

Wrd.Application.Visible = False
Wrd.Documents.Add()
With Wrd
.Selection.TypeText("Welcome To www.ShotDev.Com")
End With
Wrd.ActiveDocument.SaveAs(Server.MapPath(DocName))
Wrd.Application.Quit()
Wrd = Nothing

End Sub
End Class

Screenshot

ASP.NET(vb.net) & Word (Word Application) - Create Word Document

.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.