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?
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.
Related
The title probably doesn't reflect what I'm trying to do well.
I am working on a Task Pane Office Add-in, mainly for Word, that is currently the new type of Add-in using Office.js, however, we need to support Word 2010, so to my understanding we need a VSTO version of the Add-in that does the same things.
We don't need to interact with the document, we don't read or write to the document, so we don't need any code to run outside of the web app, the whole Add-in is written in HTML and JavaScript. So my thinking is we could create a very simple VSTO Add-in that just contains a WebView that loads our web app without Office.js.
Is that a reasonable way of achieving backward compatibility to Word 2010?
My problem is finding a starting place to do this. Word 2010 is very old, and it seems using a WebView has all sorts of compatibility issues and other bugs. I'm having trouble finding reliable information/tutorials.
Is it possible to bundle WebView2 with the Add-in to eliminate the backward compatibility issues?
Or maybe my thinking here is all wrong, and there is better way of achieving backward compatibility?
I'm open to anything, just seeking information.
One option is share code/ libs. If you need the same functionality. This will enable you to continue servicing your users that use the VSTO Add-in on Office on Windows and the ones using Office addins.
Create a shared class library by refactoring code into a .NET class library.
Create a REST API wrapper using ASP.NET Core for the shared class library.
Call the REST API from the Office Add-in to access shared code.
Microsoft Share code docs
It doesn't work that way. The WebView is not enough for running web add-ins on older Office applications like Word 2010. The support for add-ins should be implemented in the host application itself.
The best what you could do is to develop a VSTO based add-in without relying on the existing web add-in. Or just create a web app (without officejs involved) which can be run in a browser hosted on the task pane in Word.
Does anyone know if a tool exists that lets you inspect Office Open XML (e.g., a Microsoft Word .docx file) in the same manner that Chrome lets you view the fully rendered web page alongside the underlying element structure and interact with it in real-time?
I am working on a project where I need to be able to do some fairly fine-tuned, programmatic manipulation of docx files. Having such a tool would really help provide a better understanding of the Office Open XML spec and its behavior.
Kind regards.
I am a contributor on a new VS Code extension that can modify OOXML parts and get diffs of the xml when there are changes from outside e.g. Word edits a document in real time the way you describe. You can get it on the VS Code Marketplace:
OOXML Viewer
And review the code on GitHub:
OOXML Viewer Repo
I am not aware of a convenient tool like that. It should be relatively easy to make an Add-in that gets the relevant OOXML from the document selection, but I couldn't find anything on the Office Add-ins Store, or Script Lab samples/snippets. (The closest I could find, might be this Web Add-in sample app).
With the Open XML SDK Productivity Tool, you can also modify document and use the Compare Files feature to see the changes in the OOXML, and the code needed to reproduce them.
There are few more tools for Visual Studio and Chrome mentioned on Eric White's Blog:
Open XML Package Editor Power Tool for Visual Studio
OOXML Tools Extension for Chrome
I have started using Git for my other development projects (PHP, HTML, JavaScript, etc.) and can now see how beneficial it is, however I've been unable to find anything similar for Dynamics CRM 2011/2013 as a lot of the solution development is done within the web interface.
I'm guessing this is not possible, but could someone with more experience than me please confirm this or let me know which tools I should be looking into?
Thanks
You can use the Visual Studio Developer Toolkit available in the SDK to version control your plugins and web resources initially. I'd recommend this as your first step.
If you choose to take it further you can also look at using the SolutionPackager tool to version control your solutions. This will split out your solution zip file into separate version controllable files for each component. It works best when you follow the developer workflow outlined in the linked MSDN article
I have an Excel 2010 Automation project using Microsoft Office Interop library in C#.NET. But now i need to migrate it to work with Open XML SDK 2.0. Any guidelines or suggestions?
OpenXML SDK provides far too many low level access / functions. It consumes some time to master but has huge flexibility.
For starters, use libraries like EPPlus or ExcelPackage. If you have very very large files to process frequently, OpenXML should be best bet.
I'm new with this Perl Win32::OLE automation. I have been reading and trying out some examples. I have a few questions (excuse me if i'm using incorrect terminologies - do correct me):
Can OLE be used to automate Visual
Studio 2005? I only found examples
with Word, Excel and IE. How do
you know which app can be used?
How do I get the name of the program ID
to be used. For instance, "Excel" in
Win32::OLE->new('Excel.Application')
How do I get the available functions
for each programs. For instance,
Workbook, only can be used with
Excel, not Word.
Thanks for your time :)
The Win32::OLE documentation provides a rudimentary starting point.
As for your questions:
I do not think VS 2005 provides an OLE automation interface.
See this post on PerlMonks.
An excellent source of information for Microsoft Office applications is the Object Browser. You can access it via Tools -> Macro -> Visual Basic Editor. Once you are in the editor, hit F2 to browse the interfaces, methods, and properties provided by Microsoft Office applications.
Typically, the OLE automation model is up to the software you are trying to automate. You can usually figure it out by looking at the documentation, for example for the Microsoft products it will be in MSDN. For Visual Studio and the Office tools, you can also use the macro recorder to help figure out the syntax, since you can record a script that does vaguely what you want and then modify it.
Also, Visual Studio comes with the tool called "OLE/COM object viewer" (Oleview.exe) which can be used to open and read the type libraries for some target software. The type library is usually contained within a .tlb or .dll file and contains the more or less full description of the OLE Automation types defined for the application. You can look at the .idl thus reverse engineered and try to figure out what kind of things are possible.
To get a brief overview and introduction I would suggest looking at this The Perl Journal #10. Created by Jan Dubois.
Also here are some examples, if you havn't stumbled across it yet Examples
Hope it helps