本文介绍了我们可以在Office.js加载项中加载Excel文件吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Excel中在线加载Excel文件.

I am trying to load a Excel file in Excel online.

通过加载文件,我的意思是说我从服务中接收到一个Excel文件,该文件需要显示在当前工作簿上.

By loading a file I mean lets say I receive an Excel file from a service which I need to show on the current workbook.

文件位置可以是URL或我站点中的任何文件夹.

The file location can be a url or any folder in my site.

Excel.run(function (context) {
 var workbook = context.workbook;
 //workbook.load or something ?
}

推荐答案

加载项的作用域仅限于文档,旨在扩展Office应用程序的功能,而不是作为打开文档本身的机制.

Add-ins are scoped to the document and are intended to extend the functionality of the Office application, not as a mechanism for opening documents themselves.

您所描述的是 WOPI 适用于. WOPI协议提供Office与文档存储之间的接口.

What you're describing is what WOPI is intended for. The WOPI protocol provides an interface between Office and the document storage.

虽然您可以实现自己的WOPI客户端,但这并不是一个微不足道的过程.一种简单得多的方法是通过 Microsoft Graph 利用用户的OneDrive.存储在OneDrive中的文件包括 webUrl 属性.如果您打开此URL,它将自动在正确的应用程序(Excel,Word等)中打开文件.

While you can implement your own WOPI client, it isn't a trivial process. A far simpler approach is to leverage the user's OneDrive via Microsoft Graph. Files stored in OneDrive include a webUrl property. If you open this URL it will automatically open the file in the correct application (Excel, Word, etc).

这篇关于我们可以在Office.js加载项中加载Excel文件吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 07:39