无法在Excel中的setSelectedDataAsync之后编辑单元格 [英] Unable to edit cells after a setSelectedDataAsync in Excel

查看:310
本文介绍了无法在Excel中的setSelectedDataAsync之后编辑单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Office加载项平台开发Excel的加载项。在这个加载项中,我使用setSelectedDataAsync **函数将数据写入一个范围。它工作正常,但数据写入后,我不能删除或编辑单元格(虽然我可以选择新的范围),除非我单击工作表外的任何地方或双击单元格。我认为这是Excel没有正确重新获得焦点的问题(应用程序顶部的文件名保持灰显)。



有些用户似乎认为Excel变得无反应,这是一个问题。



这是一个已知的问题吗?有没有解决这个问题?

我已经注意到,setSelectedDataAsync是比方式设置range.values矩阵,然后ctx.sync() 。我没有使用后一种方法而失去了一些重要的功能吗?解决方案

设置完数据后)。我们可以看看。

惊奇的发现 setSelectedDataAsync 的运行速度比范围快。 values set。批处理语法允许您将不只一条指令组合在一起,而是将多个相关指令(例如设置数字格式,字体,背景等)组合在一起,并且您可以通过一个同步()在一个批处理中发送所有指令。因此,将相关指令组合在一起时效率更高。

没有限制使用哪种API;然而,Excel1.1版本是随Office 2016一起引入的,然后自那以后就增加了一些新功能。

setSelectedDataAsync() API被设计用于跨Excel,Word等主机工作,在设置数字格式,格式等方面更深入。

I'm developing an add-in for Excel using the Office Add-ins platform. In this add-in I'm writing data to a range using the setSelectedDataAsync** function. It works fine, but after the data is written, I'm not able to delete or edit the cells (although I can select new ranges) unless I click anywhere outside the worksheet or double click a cell. I think it is an issue with Excel not regaining focus correctly (the filename in the top of the app remains grayed out).

Some users seem to think that Excel becomes unresponsive, which is a problem.

Is this a known issue? Is there a work around for this?

** I have noticed that setSelectedDataAsync is way, way quicker than setting range.values to a matrix and then ctx.sync(). Am I losing some important functionality by not using the latter method?

解决方案

This is not a known issue (unable to interact with worksheet after setting the data). We can look into that.

Surprised to hear that setSelectedDataAsync works faster than the range.values set. The batched syntax allows you to combine not just one instruction, but many related instructions such as setting number format, font, background, etc. and you can do a single sync() to send all instructions in one batch. So, it is more efficient when you combine related instructions together.

There is no restriction of which API to use as such; however the Excel1.1 version was introduced with Office 2016 and then there have been many releases since then incrementally adding new features along the way.

setSelectedDataAsync() API was designed to work across hosts such as Excel, Word, etc. and hence doesn't go deeper in-terms of setting number format, formats, etc.

这篇关于无法在Excel中的setSelectedDataAsync之后编辑单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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