如何将 Office 插件连接到服务器?

How to connect an Office addin to a server?

似乎大多数 Office 插件都没有服务器或数据库。
但似乎有些插件确实有服务器支持。

我已经通过 mean-stack 建立了网站。
我们确实可以使用 angularjs 来构建 Office 插件的前端。

如何将 Office 插件的前端连接到 (mongo + express + node) 服务器?

摘自Office Add-ins overview(强调)

What can an Office Add-in do?

An Office Add-in can do almost anything a webpage can do inside the browser, such as the following:

  • Extend Office native UI by creating custom ribbon buttons and tabs.
  • Provide an interactive UI and custom logic through HTML and JavaScript.
  • Use JavaScript frameworks such as jQuery, Angular, and many others.
  • Connect to REST endpoints and web services via HTTP and AJAX.

因此,使用您选择的最喜欢的框架。

您熟悉 MEAN 堆栈,因此请使用 Angular、Mongoose 或任何其他 Javascript MongoDB 客户端 在插件中 就像从任何其他前端网页一样连接到您的服务器。

奖金:Add-in with Angular 2

How to connect an office addin to a server?

您的 Web 应用程序到 Office 的连接点是清单文件。请在 Anatomy of an Office Add-in 上查看更多信息。您的 Web 应用程序需要与 Office 本身进行通信,因此您需要包含 Office.js 库并在 运行 客户端上的任何其他功能之前对其进行初始化。