4

I've done find and replace solution in Micorsoft.Office.Interop.Word in asp.net I would like to move this solution on NetOffice in my asp.net server where there is no Microsoft Word. I got error

progid not found

. What I do wrong because on my computer where I have Microsoft Word this code work fine in NetOffice?

Word.Application wordApp = new Word.Application(); <-- here is this error

VVN
  • 1,607
  • 2
  • 16
  • 25
Daniel
  • 197
  • 1
  • 3
  • 16
  • In NetOffice you may don't have Microsoft Word. – VVN Mar 05 '16 at 12:45
  • You said your asp.net server where there is no Microsoft Word. that's the key that you must install software Microsoft Office family. then your code will run well. – Potato Mar 05 '16 at 12:46
  • 2
    NetOffice is a wrapper to the office applications not a replacement, Word must be installed on the server. Automating office from ASP.Net is not recommended anyway. – Alex K. Mar 05 '16 at 12:48
  • Is there any solution that my code will be work without install word on server or is there any package with code similar to Micorsoft.Office.Interop.Word where should work without install word ? – Daniel Mar 05 '16 at 13:30

2 Answers2

5

NetOffice is just a COM Wrapper to the office applications, therefore it requires that you have the office app installed on the machine where your application is running.

i.e. You need to have Microsoft Word installed on any machine that you intend to run an app that uses NetOffice.Word.

If this was a desktop app, all you would have to do, would be to install Word on the machine, but given you want to use office automation from a server, and Microsoft does not recommend it, you should look into other options of interfacing with Word documents directly via OpenXML without having to install Word on the machine.

I'd recommend taking a look at the DocX library: https://github.com/WordDocX/DocX

As well as the articles below:

C. Augusto Proiete
  • 24,684
  • 2
  • 63
  • 91
0

Your code should work with NetOffice, but you need to add a using statement:

using Word = NetOffice.WordApi;

You also need to disable the setting Embed Interop types for all NetOffice DLL's.

Jbjstam
  • 874
  • 6
  • 13