Reputation: 784
I'm able to do a response.write of an mhtml string to enable me to save a word doc from the browser, however when going to save as it defaults to a the "single file web page" type. My goal is to have the file default to either word document, or word 97-2003 when doing a save as. I'm currently exploring the Microsoft.Office.Interop.Word assembly and was wondering if anyone knows if it's possible to use the interop assembly to convert an mhtml string into a savable doc from the browser, or if you might have any other ideas for solutions.
Upvotes: 0
Views: 615
Reputation: 49397
Yes, you are free to automate Word to get the job done. But Word should be installed on the PC if you are going to automate from a web page script. If you are talking about the server-side, 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.
You may consider using the Open XML SDK instead. See Welcome to the Open XML SDK 2.5 for Office for more information. Also you may find third-party components designed for the server-side execution. Try using any search engine to find any of them.
Upvotes: 1