Click here to Skip to main content
15,918,109 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
i have created a word automation project which working fine in local were as if i install in windows server its not working and shows failed due to class not registered

and researched in internet that word automation will not work if MS Office not installed in the server
can't able to install Word in server and the Component is also not present there

If i change to use OpenXML i have to change the entire i don't want that

I need a solution for that
provide some info

Thanks in advance

What I have tried:

This the error i got in ErrorLog

Catch Exception : Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
Updated 15-Nov-22 2:23am
Richard MacCutchan 15-Nov-22 4:03am    
There is no solution. Word automation will only work on systems that have Word installed.
Manojkumar-dll 15-Nov-22 23:23pm    
Thank you for the comment sir
Dave Kreskowiak 15-Nov-22 8:28am    
You have no choice but to rewrite the code to use OpenXML, or similar library. You can NOT, under any circumstances, get Office interop to work in a non-desktop application.
Manojkumar-dll 15-Nov-22 23:23pm    
Sure i'll try to rewrite my code to OpenXML Thank you

1 solution

The documentation states (bold mine)
All current versions of Microsoft Office were designed, tested, and configured to run as end-user products on a client workstation. They assume an interactive desktop and user profile. They do not provide the level of reentrancy or security that is necessary to meet the needs of server-side components that are designed to run unattended.

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

Reference: Considerations for server-side Automation of Office - Microsoft Support[^]

Looks like you will either have to rethink your automation project, or rewrite it to use OpenXML. Do you really need Word or can whatever you are producing be a Text, an RTF or other format document?
Share this answer
Dave Kreskowiak 15-Nov-22 8:27am    
All current versions of Microsoft Office were designed, tested...

"Tested"? Yeah, right. When was the last time MS tested anything?
CHill60 15-Nov-22 8:59am    
LOL! That's the truth
Manojkumar-dll 15-Nov-22 22:47pm    
Thanks For the Solution @CHill60 this is what i also faced in the internetr the same solution you given to me
Actually i need MS WORD application because my code will automatically create the word file only if the application present there
CHill60 16-Nov-22 3:01am    
Then, despite Microsoft's strong advice against doing so, you will need to install Word onto the server, which you have already said you cannot do. So, you cannot do what you want to do. Accept that fact and use OpenXML. As for your code automatically creating the word file only if the application is there, then that is for you to change your code - why not create a Word document if word is installed but a text file if not.
Manojkumar-dll 16-Nov-22 5:07am    
it Makes sense
Already working it on OpenXML
Thank you so much for the valuable comment!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900