【问题标题】:Unable to open remote file in Word Online无法在 Word Online 中打开远程文件
【发布时间】:2016-02-23 04:06:26
【问题描述】:

我正在尝试使用以下基于 .

function displayContents(myBase64) {
    Word.run(function (context) {
        console.log(Office.context.requirements.isSetSupported("WordApi", "1.1"));

        // Create a proxy object for the document.
        var thisDocument = context.document;

        // Queue a command to clear the body contents. 
        thisDocument.body.clear();
        thisDocument.body.insertFileFromBase64(myBase64, "replace");

        // Create a proxy object for the default selection. 
        //var mySelection = thisDocument.getSelection();

        // Queue a command to insert the file into the current document.
        //mySelection.insertFileFromBase64(myBase64, "replace");

        // Synchronize the document state by executing the queued commands, 
        // and return a promise to indicate task completion.
        return context.sync();
    })
    .catch(function (error) {
        console.log('Error: ' + JSON.stringify(error));
        if (error instanceof OfficeExtension.Error) {
            console.log('Debug info: ' + JSON.stringify(error.debugInfo));
        }
    });
}

这不起作用(使用 body.insertFileFromBase64 或 myselection.insertFileFromBase64)。该代码在 Word 的常规版本中起作用。我收到以下错误:

错误: "name":"OfficeExtension.Error", “代码”:“一般异常”, "message":"此浏览器不支持请求的 API。", "traceMessages":[],"debugInfo":{}} LoadOfficeDoc.js:51 调试信息:{}

Office.context.requirements.isSetSupported("WordApi", "1.1") 返回 true。

是我做错了什么还是此功能无法在线使用?

【问题讨论】:

    标签: office-addins office-js


    【解决方案1】:

    目前仅 Windows(和 iPad?)上的 Word 2016 支持新的 Word API(例如使用 Word.run 的任何内容)

    虽然根据文档 isSetSupported 应该返回 false。

    【讨论】:

      【解决方案2】:

      没错,这实际上是我们目前正在处理的一个错误。 WAC 不完全支持该要求集,因此该方法必须返回 false。

      【讨论】:

      • 感谢 Juan 的澄清,这个功能会在在线版本中实现吗?
      • 绝对!它很快就会到来!
      • 此修复现已上线! Office.context.requirements.isSetSupported('WordApi', 1.1) 和 Office.context.requirements.isSetSupported('WordApi', 1.2) 现在都返回 false。
      • 感谢 Juan,现在需求检查工作得更好了。但我的问题应该更具体一些,我想知道将来是否可以在 Word Online 中打开远程 word 文件的功能。
      猜你喜欢
      • 2014-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-27
      • 2022-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多