0

Word アドインの開発に word javaScript Api を使用しています。サーバーからファイルをロードし、コンテンツをドキュメントに挿入する必要があります。現在、.docx ファイルは正常に機能し、ドキュメントに挿入されていますが、. rtf 形式のファイル コンテンツをドキュメントに変換すると、Word で次のエラーがスローされます。

Error: {"name":"OfficeExtension.Error","code":"RunMustReturnPromise","message":"The batch function passed to the \".run\" method didn't return a promise. The function must return a promise, so that any automatically-tracked objects can be released at the completion of the batch operation. Typically, you return a promise by returning the response from \"context.sync()\".","traceMessages":[],"debugInfo":{},"stack":"RunMustReturnPromise: The batch function passed to the \".run\" method didn't return a promise. The function must return a promise, so that any automatically-tracked objects can be released at the completion of the batch operation. Typically, you return a promise by returning the response from \"context.sync()\".\n   at t.throwError (https://appsforoffice.microsoft.com/lib/beta/hosted/word-win32-16.01.js:21:233250)\n   at Anonymous function (https://appsforoffice.microsoft.com/lib/beta/hosted/word-win32-16.01.js:21:202009)\n   at yi (https://appsforoffice.microsoft.com/lib/beta/hosted/word-win32-16.0

以下のコードを使用してコンテンツを挿入しています。

range.insertFileFromBase64(myBase64, Word.InsertLocation.start);

RTF形式のファイルコンテンツをWord文書に挿入する方法を教えてください。ありがとう。

4

1 に答える 1