Reputation: 1470
I want to make a few specific changes to a .docx file that is located in an azure blob storage container; for example: change the format of tables, insert text at defined positions, replace some strings, .... I know how to address the file in azure blob and load its content. I also know how to manipulate content of a word document using Microsoft.Office.Interop.Word on a client PC.
Now my questions: 1. Can I use Microsoft.Office.Interop.Word in an asp.net mvc web application to manipulate a word.docx? 2. What alternative ways of manipulating word.docx (as described above) do I have? Regards, Manu
Upvotes: 2
Views: 1554
Reputation: 49453
- Can I use Microsoft.Office.Interop.Word in an asp.net mvc web application to manipulate a word.docx?
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.
- What alternative ways of manipulating word.docx (as described above) do I have?
As a possible workaround you may consider using the Open XML SDK if you deal with open XML documents only, see Welcome to the Open XML SDK 2.5 for Office. Or just any third-party component designed for the server-side execution (for example, Aspose).
Upvotes: 1
Reputation: 488
You can use NPOI to create and/or manipulate Office documents. NPOI does not require any Microsoft Office version to be installed on the machine you are running the server on, which can be practical. I have used it for manipulating Excel documents, and it was quite easy to use.
Upvotes: 1