【问题标题】:How to use setSelectedDataAsync() in Excel 2016 for Windows如何在 Excel 2016 for Windows 中使用 setSelectedDataAsync()
【发布时间】:2016-10-18 09:02:59
【问题描述】:

我正在为 Microsoft Excel 编写插件并尝试使用 setSelectedDataAsync() 函数。它在 Excel 2013、Excel Online 和 Excel 2016 for Mac 中运行良好,但在 Windows 中的 Excel 2016 中运行良好。

我正在使用以下函数进行测试:

function testWriting() {
        var test = [["one"], ["two"]];
        Office.context.document.setSelectedDataAsync(test, 
             { 
                 coercionType: Office.CoercionType.Matrix 
             }, 
             function(result) {
        });
    }

当我标记为空单元格时它有效,但当我标记要覆盖的填充单元格时无效。这是 Excel 2016 中的错误还是我该怎么做?

谢谢

【问题讨论】:

    标签: office365 office365api office-js office365-apps


    【解决方案1】:

    这是设计使然。如果 setSelectedDataAsync 方法用值覆盖现有单元格,则该方法将失败。

    【讨论】:

    • 那么你将如何解决这个问题?您将在 Windows 上的 Excel 2016 中使用什么功能?该函数还需要在 Excel 2013 中可用,这使得这很棘手。
    • 幸运的是,2016 年有一组非常丰富的 Excel API 可供您使用。您可以验证值是否重叠,根据需要移动单元格等。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-01
    • 2019-06-27
    • 2017-08-01
    • 2015-11-10
    • 1970-01-01
    • 1970-01-01
    • 2017-09-17
    相关资源
    最近更新 更多