Hello,
I am trying to read Ms word using asp.net. I am using Ms Office 2003,
I have also installed Office PIA and refered COM to get classes for
automation. Code work fine on my local server, but making problem
with remote server.
My code:
---------------------------------
Function getTextFromFile() As String
Dim str As String
Dim WordApp As New Word.ApplicationClass
Dim filepath = Server.MapPath("~/files/Hello.doc")
Dim File As Object = filepath
Dim nullobj As Object = System.Reflection.Missing.Value
Dim doc As Word.Document = WordApp.Documents.Open(File,
nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj,
nullobj, nullobj, nullobj, nullobj)
Dim doc1 As Word.Document = WordApp.ActiveDocument
Dim m_Content As String = doc1.Content.Text
str = m_Content
doc.Close(nullobj, nullobj, nullobj)
Return str
End Function
If I make Identity as "The launching user", then I see below error:
----------------------------------------------------------------------
Command failed
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException:
Command failed
if I make identity as "The interactive user" then I see below error:
-------------------------------------------------------------------------
Retrieving the COM class factory for component with CLSID
{000209FF-0000-0000-C000-000000000046} failed due to the following
error: 8000401a.
Help needed please.
Thanks
Addition:
When Identity as "The launching user", along with error " ", from
event Viewer, I can see following error with source "Microsoft Office
11":
The description for Event ID ( 2001 ) in Source ( Microsoft Office
11 ) cannot be found. The local computer may not have the necessary
registry information or message DLL files to display messages from a
remote computer. You may be able to use the /AUXSOURCE= flag to
retrieve this description; see Help and Support for details. The
following information is part of the event: Microsoft Office Word, .
Thanks