3

I'm not sure whether "sideloading" is the correct term: Is therea an API to programatically install an Office Javascript API based add-in (e.g. a Task Pane app) in to the current / specific document on the desktop (at least on Windows)?

VisualStudio does this when you debug an App for Office project. How do I go about achieving the same?

Sameera
  • 1,025
  • 13
  • 36

1 Answers1

5

There is no current way to programmatically insert an app (now "Office Add-in") into a document via JavaScript. It is a scenario that the product group is aware of, but it's not something we have yet.

You can insert an it via the Open XML SDK (which is actually how Visual Studio does this), but that would be .NET code running outside of the Office add-in (and not on the currently open document). Visual Studio in particular is atually inserting an app registered into the special local registry-based "Developer Store", but I can't think of any reason why wouldn't work for an actual Office-Store or SharePoint App Catalog-hosted app. If you are interested in going this route, let me know, and I might be able to find some pointers on the code you'd need to write.

Finally (though it probably goes without saying), you can insert an app into a Template, rather than a regular document. That way, anyone creating a document from that template would get your add-in -- I believe that's what the Paypal Invoicing add-in in Excel does, for example.

Hope this helps,

~ Michael Zlatkovsky, Developer on Office Extensibility team, MSFT

  • Thanks Michael! Doing it via .NET code is what we were after. We could also do the Template approach but, we wanted to have a way to convert existing docs to have the add-in inserted automatically. Please do point me to any samples available for the OpenXML SDK way of doing it. – Sameera Oct 30 '15 at 02:43
  • 1
    The simplest way is probably to just create a document with the Office Add-in inserted within it, then run a tool that will analyze your document and generate the C# code you need to re-create such document. Please see http://tech.trailmax.info/2014/04/open-xml-sdk-tool-to-analyse-documents-and-generated-c-code/, for a blog post that describes the process. The tool itself is available at http://www.microsoft.com/en-gb/download/details.aspx?id=30425. Hope this helps! – Michael Zlatkovsky - Microsoft Oct 30 '15 at 16:58