Word Online不支持该操作

时间:2017-05-31 20:15:22

标签: ms-word office-js

当我尝试在Word Online中启动加载项时,它会显示以下内容:

{
    "name": "OfficeExtension.Error",
    "code": "NotAllowed",
    "message": "The action isn’t supported in Word Online. Check the OfficeExtension.Error.debugInfo for more information.",
    "traceMessages ": [],
    "innerError ": null,
    "debugInfo ": {
        "code ": "NotAllowed ",
        "message ": "The action isn’t supported in Word Online. Check the OfficeExtension.Error.debugInfo for more information.",
        "errorLocation ": "Range.delete "
    }
}

以下是代码:

Word.run(function (context) {

    // Getting current selection    
    var range = context.document.getSelection();
    range.delete();
    range.insertHtml(text, TEXT_REPLACE);

    return context.sync().then(function () {

    });

}).catch(function (error) {
    handleError(error);
});

根据Office Add-In documentation,它应该受Word Online支持

1 个答案:

答案 0 :(得分:0)

Word Online支持此功能。也就是说,请确保您的加载项ReadWriteDocument为您的加载项permissions指定async