D
deepmh
Hi,
I am developing one application in asp.net where I need to use the microsoft word template for creating envelopes, but I am not event able to create the ms word object, it's giving me error the application is busy, I have set the requirement permission for asp.net user. so no problem with security, can anyone help me out in this, This is very urgent.
This is my sample code : ( In this code I am just writing some text in word document not trying for template)
Dim oWordApplic As Word.ApplicationClass
Dim oDoc As Word.Document
Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
oWordApplic = New Word.ApplicationClass()
open("test.doc")
InsertText("This is the text")
InsertLineBreak()
Save()
Quit()
Catch exc As Exception
Response.Write(exc.Message)
End Try
End Sub
Sub open(ByVal strFilename As String)
Dim fileName As Object
Dim readOnly1 As Object
Dim isVisible As Object
Dim missing As Object
fileName = strFilename
readOnly1 = False
isVisible = True
missing = System.Reflection.Missing.Value
oDoc = oWordApplic.Documents.Open(fileName, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, isVisible)
oDoc.Activate()
End Sub
Sub InsertText(ByVal strText As String)
oWordApplic.Selection.TypeText(strText)
End Sub
Sub InsertLineBreak()
oWordApplic.Selection.TypeParagraph()
End Sub
Sub Save()
oDoc.Save()
End Sub
Sub Quit()
Dim missing As Object
missing = System.Reflection.Missing.Value
oWordApplic.Quit(missing, missing, missing)
End Sub
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
I am developing one application in asp.net where I need to use the microsoft word template for creating envelopes, but I am not event able to create the ms word object, it's giving me error the application is busy, I have set the requirement permission for asp.net user. so no problem with security, can anyone help me out in this, This is very urgent.
This is my sample code : ( In this code I am just writing some text in word document not trying for template)
Dim oWordApplic As Word.ApplicationClass
Dim oDoc As Word.Document
Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
oWordApplic = New Word.ApplicationClass()
open("test.doc")
InsertText("This is the text")
InsertLineBreak()
Save()
Quit()
Catch exc As Exception
Response.Write(exc.Message)
End Try
End Sub
Sub open(ByVal strFilename As String)
Dim fileName As Object
Dim readOnly1 As Object
Dim isVisible As Object
Dim missing As Object
fileName = strFilename
readOnly1 = False
isVisible = True
missing = System.Reflection.Missing.Value
oDoc = oWordApplic.Documents.Open(fileName, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, isVisible)
oDoc.Activate()
End Sub
Sub InsertText(ByVal strText As String)
oWordApplic.Selection.TypeText(strText)
End Sub
Sub InsertLineBreak()
oWordApplic.Selection.TypeParagraph()
End Sub
Sub Save()
oDoc.Save()
End Sub
Sub Quit()
Dim missing As Object
missing = System.Reflection.Missing.Value
oWordApplic.Quit(missing, missing, missing)
End Sub
**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...