尝试使用context.application.createDocument编辑创建的文档时出错 [英] Error when trying to edit created Document with context.application.createDocument

查看:96
本文介绍了尝试使用context.application.createDocument编辑创建的文档时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Office Web加载项,并在Word Online中运行. 我正在尝试编辑使用context.application.createDocument创建的文档.这是代码:

I am developing an office web addin, and running in Word Online. I am trying to edit a document that I have created with context.application.createDocument. Here is the code:

   Word.run(function (context) {
        var myNewDoc = context.application.createDocument(base64);
        context.load(myNewDoc);
        return context.sync().then(function () {

            myNewDoc.body.insertText('Hello World!', 'Start');
            myNewDoc.open();
            return context.sync();

        });      
    });

在插入text/context.sync()时出现此错误:

I get this error at insertion of text / context.sync():

GeneralException Word Online不支持该操作.检查 有关更多信息,请使用OfficeExtension.Error.debugInfo.声明:var body = v.body;

GeneralException The action isn’t supported in Word Online. Check the OfficeExtension.Error.debugInfo for more information. statement: var body=v.body;

请帮助.

推荐答案

此错误是设计使然.在新创建的文档上,您只能调用打开方法.不支持所有其他方法,这意味着您无法操作新创建的文档.

This error is by design. On the newly created document, you can only call open methods. All others methods are not supported which means you can't operate the newly created document.

这篇关于尝试使用context.application.createDocument编辑创建的文档时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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