I have a web application that creates complex Office documents in Excel, Word, and PowerPoint; and I need to convert the application from Visual Studio to Visual Studio Code. The previous application uses the Microsoft Office Interoperability Assemblies to generate and manipulate the documents. So far I haven't found any comparable interface or extension for Visual Studio Code. Can someone point me to a possible solution?
Asked
Active
Viewed 477 times
1 Answers
0
You can use the same technique even in VSCode. It allows adding COM references to projects, see Adding Microsoft.Office.Interop.Excel to VS Code for more information.
The previous application uses the Microsoft Office Interoperability Assemblies
Office Automation is used for dealing with Office applications locally. If you are moving the code to VSCode you may also consider using the Open XML SDK instead, of course, if you deal with open XML documents only. Read more about that in the Welcome to the Open XML SDK 2.5 for Office article. Also you may take a look at any third-party components that don't require Office applications installed on the system.

Eugene Astafiev
- 47,483
- 3
- 24
- 45
-
bear in mind that vscode is just an IDE, not a language or framework. It doesn't determine what you can do in your application - it is just a tool to help you write code. I guess the question here would be how or in what way are you finding you can't work in VSCode? – topsail Jun 11 '22 at 19:23
-
There is no COM References dialog in VSCode. The approach is a bit different to add a COM reference there. – Eugene Astafiev Jun 11 '22 at 19:30
-
Well I agree that it would be more difficult. But I'm just saying its not impossible. You could (for instance, or at least in theory) add the reference in the csproj file yourself. However, I have never heard of any extensions that make VSCode like Visual Studio in this respect, so I guess you are left with those two options - figure out the details to handle references and writing code without the IDE support you are used to, or move to other libraries for interacting with office documents. – topsail Jun 11 '22 at 19:36
-
Absolutely correct. – Eugene Astafiev Jun 11 '22 at 19:38
-
Perhaps it is not entirely clear if you are asking how to work with office interop assemblies in VSCode, or if you are asking what alternatives there are because you don't want to or can no longer use office interop assemblies. – topsail Jun 11 '22 at 19:39