ASP.NET(vb.net) & Word (Word Application) - BuiltInDocumentProperties - This article example scripts you will learn how to set BuiltInDocumentProperties in Word document using ASP.NET Scripts
ShotDev Focus:
- ASP.NET(vb.net) & Word (Word Application) - BuiltInDocumentProperties
Example
AspNetWordDocProperties.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="AspNetWordDocProperties.aspx.vb" Inherits="AspNetWordDocProperties" %> <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>
AspNetWordDocProperties.aspx.vb
Imports Microsoft.Office.Interop.Word
Public Class AspNetWordDocProperties
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.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()
Wrd = Nothing
End Sub
End Class
Screenshot

