2

I'm currently developing a tool using the Office javascript API. However, I would like to provide an own Excel function (something like =SUM(A1:A5)), which is based on code in C#.

Is there any way to avoid shipping two individual plug-ins from the users point of view? Can I combine both technologies to one plug-in?

Dirk Vollmar
  • 172,527
  • 53
  • 255
  • 316
jonathan
  • 35
  • 6
  • Hi, thanks already for all the great suggestions. However, actually I want rely on the advantages of the new JS API (that it is running in kind of a browser), but expand the scope on a windows machine by some extra function (this is obviously not available on other systems, but the JS part would be). Unfortunately using a VSTO plugin makes it much more complicated using JS code within this plugin. I considered a Browser ActiveX element, but this comes with other complications. So, the new API seems to suit better. Any other ideas to deal with it? – jonathan Nov 30 '16 at 00:50

3 Answers3

1

If you are only targeting the desktop version of Excel then you can create a VSTO add-in instead of a JavaScript-based add-in. Within this adding you can include the code for your custom functions in the VSTO project and make sure they are correctly registered. One solution could be to create your own MSI-based installer, e.g. using Windows Installer XML (WIX) or Nullsoft's NSIS tool.

With this "classic" VSTO add-in technology you won't be able to target Excel on Mac, on mobile platforms or Excel Online in the browser though.

Dirk Vollmar
  • 172,527
  • 53
  • 255
  • 316
  • For me, the best desktop based addin solution to create udf (user defined function) is excel dna https://excel-dna.net – Benoit Patra Nov 29 '16 at 07:48
1

Yes there is also an alternative solution to creating a desktop C# add-in with VSTO or ExcelDNA as suggested by Dirk.

A javascript web add-in is just a web page with a library : office.js filling the gap between your logic and the office host application.

Why not passing the input to an API written in C# (this can be or not the same server serving the add-in) that will do the calculation ? The javascript will be there only to pass data and set the calculation results in spreadsheet.

Benoit Patra
  • 4,355
  • 5
  • 30
  • 53
-2

I use ILMerge to combine my dlls. You can add it as a post build command so that they are merged on successful build.

Chris
  • 110
  • 5
  • 1
    ILMerge is for merging .NET assemblies, but here we deal with different technologies (C#-based Office Add-in and JavaScript-based Office Add-in), so it won't be of any help. – Dirk Vollmar Nov 29 '16 at 07:12