Я пытаюсь открыть файл с кодировкой base64 в Word Online, используя приведенный ниже код.Не удается открыть удаленный файл в Word Online
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. Я получаю следующее сообщение об ошибке:
Ошибка: "имя": "сообщение" "GeneralException", :: "OfficeExtension.Error", "код" "Этот браузер не поддерживает запрошенный API.", "traceMessages": [], "DebugInfo": {}} LoadOfficeDoc.js: 51 отладки информация: {}
Office.context.requirements.isSetSupported ("WordApi", "1.1") возвращает истину.
Я делаю что-то неправильно или эта функция недоступна в Интернете?
Благодарим вас за разъяснение Хуана, эта функциональность когда-либо будет возможна в онлайн-версии? –
Абсолютно! Это очень скоро! –
Это исправление теперь в прямом эфире! И Office.context.requirements.isSetSupported ('WordApi', 1.1) и Office.context.requirements.isSetSupported ('WordApi', 1.2) теперь возвращает false. –