How-to: Remove Managed Code Extensions (VSTO) from Documents
This week one of my students asked how he could remove the VSTO extensions of a specific Word document. I never thought about it, but if you give it a little thought, it's quite useful. Just imagine that you have a VSTO Word template solution that allows you to create a document very easily (for example with some custom task panes). Once you're done building the document you may want to save it, and give users that don't have VSTO runtime installed (or don't have access to the extenions) the possibility to open the document (without any warnings). It turns out that's not that difficult, it's even documented on the MSDN site:
How to: Remove Managed Code Extensions from Documents
You can remove references to code from your documents by clearing the embedded application manifest, or by removing the Runtime Storage Control from the document completely, including the application manifest and any cached data. The Microsoft Visual Studio 2005 Tools for the Microsoft Office System runtime includes an object model that enables you to programmatically perform these actions.
If you want to remove the assembly references from the document but keep the cached data (possibly because this data will be read later by an ASP.NET page or server application), then clear the application manifest. If you no longer need the managed code extensions or the cached data, then remove the Runtime Storage Control. full article