在Excel Online中创建和设置Office.Settings不能在Excel Online中检索 [英] Office.Settings not retrievable in Excel Online when created and set in Excel Desktop

查看:80
本文介绍了在Excel Online中创建和设置Office.Settings不能在Excel Online中检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据API文档, https://gist.github.com/VivianVenter/e5489628384f96f2d3bf9a50aace8728 >

如果我在Excel桌面上运行此要点,则可以创建设置并成功检索它们.如果我保存此工作簿并在Excel Online中将其打开并再次运行gist,则无法检索设置,则两个设置对象均返回null.

据我所知,ScriptLab加载项对于台式机和在线版本是相同的,我是否遗漏了一些东西,或者OfficeJS的意图是在创建在线版本时不使设置可用/在在线版本中不可见并设置为桌面版?

找到设置桌面:在Excel桌面中找到设置对象

在线设置为空:在Excel Online中找不到设置对象

解决方案

Office加载项的设置是基于加载项的ID存储的.并且通过侧面加载安装后,每次都会为该加载项分配一个新的id.这意味着您在开发时无法在多个平台上同步设置.

将插件提交到AppSource后,会将来自AppSource的静态ID分配给该插件,并在从AppSource安装该插件时使用它.

因此,您应该将加载项提交到AppSource以测试/实现此功能.

According to the API docs, the Office.Settings objects are saved per add-in and per document. That is, they are available only to the add-in that created them, and only from the document in which they are saved.

I'm a bit confused regarding the Office.Settings interface. I've created a gist in the ScriptLab Add-in where I set 2 setting objects (queries and queryIDs) and then retrieve them (log them to console).

Gist: https://gist.github.com/VivianVenter/e5489628384f96f2d3bf9a50aace8728

If I run this gist on Excel Desktop, then I can create the settings and retrieve them successfully. If I save this workbook and open it in Excel Online and run the gist again then I cannot retrieve the settings, it returns null for both settings object.

According to my knowledge the ScriptLab Add-in is the same for the Desktop and Online version, am I missing something, or is it the intention of OfficeJS to not make the settings available/visible in the Online version if it was created and set in the Desktop version?

Settings desktop found: The settings objects was found in Excel Desktop

Settings online null: The settings objects was NOT found in Excel Online

解决方案

Office add-in's setting is stored based on the add-in's id. And once it is installed by side-loading, a new id is allocated to the add-in every time. This means you can't sync settings on multiple platforms while developing.

Once you submitted the add-in to the AppSource, a static id from AppSource is allocated to the add-in and it is used while installing the add-in from AppSource.

So, you should submit the add-in to AppSource to test/implement this feature.

这篇关于在Excel Online中创建和设置Office.Settings不能在Excel Online中检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆