Info needed on using Word on the server RRS feed

  • Question

  • User-1518977582 posted

    One of our programmers recently ported some code from our vb6 application to our asp.net 2.0 web application and quite a few errors have been getting thrown.

    The module in which we interface with Word was written in VB6. At the top of the module weare usingImports Microsoft.Office.Interop

    The way Word is being opened is like:

            Dim objWord As Word.Application
            Dim objDoc As Word.Document
            objWord = New Word.Application
            objDoc = objWord.Documents.Add(FileName)
            objWord.Visible = True

    We are getting a ton of "File Load Exception" errors. The message we are getting is:

    "Could not load file or assembly 'Microsoft.Office.Interop.Word, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

    I've seen a Microsoft article which states that using Word on the server is not a good idea and a component designed for that purpose should be used instead. If Word is being called from a compiled dll does that make any more safe than if it were being opened and used directly form asp.net code? The .vb file is included in our asp.net solution and is compiled along with the rest of the solution. Does that make the use of Word any more server friendly? The components I've seen are thousands of dollars so I would like to find a solution that can be used by 30-50  people at a time. We need to open a template, write to the bookmarks and save it. Seems simple enough but of course it isn't ;)

    Thanks for any insight or help you can provide.

    Tuesday, July 21, 2009 8:26 AM