Error when trying to edit created Document with context.application.createDocument

扶醉桌前 提交于 2019-12-11 08:45:57

问题


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();

        });      
    });

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

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

Please help.


回答1:


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.



来源:https://stackoverflow.com/questions/50065769/error-when-trying-to-edit-created-document-with-context-application-createdocume

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!