0

We are trying to convert a .doc file to .docx using c# code. Now, while opening the MS word application, the .doc file is taking more than 20 mins to open as it trying to connect to some network path to find some template.

Is there any way we can open that .doc file without letting it connect with network drive using Microsoft technologies.enter image description here

  • See if you can open it with a regular Word version first using any of these techniques: https://superuser.com/questions/98983/word-documents-looking-for-template-on-network-drive and then re-save. – rene Feb 11 '22 at 06:23
  • I assume your c# app uses office automation (literally loading a copy of word and telling it what to do) - consider some other library that loads the document directly (NPOI? Spire? Aspose?) rather than automating Word – Caius Jard Feb 11 '22 at 06:33
  • Tool was working fine earlier actually.. now in normal opening the doc only, I am getting the issue. It's taking a long time to open. – nikhil nishant Feb 11 '22 at 06:37

1 Answers1

0

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. Read more about that in the Considerations for server-side Automation of Office article.

Instead, you may consider using any third-party components designed for the server-side execution. The Open XML SDK can be considered if you deal with open XML documents only, see Welcome to the Open XML SDK 2.5 for Office for more information.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45