1. Create a Word document as per the need and place the bookmark for
the text that need to be changed dynamically and save it in a location
2. Add the Microsoft Object Library to the code
3. Imports Word = Microsoft.Office.Interop.word
4. Use the below code snippet in your asp.net application to create
word document on a fly
Dim oWord As Word.Application
Dim oDoc As Word.Document
oWord = CreateObject("Word. Application")
oDoc = oWord.Documents.Open("<FILE LOCATION>")
With oDoc.Bookmarks
.Item("<BOOKMARK NAME IN WORD
DOC>")Range.Text = "<Either value from front end or value form
database")
End With
oDoc.Save()
oDoc = Nothing
oWord = Nothing
Please post your queries incase of any doubts.
No comments:
Post a Comment