insertSlidesFromBase64 在客户端 Powerpoint 上工作,但不在 Web 版 Powerpoint 上工作
insertSlidesFromBase64 Working on Client Powerpoint, But not on Powerpoint for the web
这是我使用的代码
async function insertPptxFromBase64String(chosenFileBase64) {
Office.context.document.getSelectedDataAsync(Office.CoercionType.SlideRange, function (asyncResult) {
try {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {``
console.log(asyncResult.error.message);
} else {
const selectedSlideID = asyncResult.value.slides[0].id;
PowerPoint.run(async function(context) {
context.presentation.insertSlidesFromBase64(chosenFileBase64, {
formatting: "UseDestinationTheme",
targetSlideId: selectedSlideID + "#"
});
await context.sync();
});
}
}
catch (error) {
reject(console.log(error));
}
});
}
此代码选择当前所选幻灯片的幻灯片 ID,并在之后插入演示文稿。
它在两个平台上都运行完美,但大约一个月前,它停止了在线 Powerpoint(网络上的 powerpoint)的工作。它仍然在客户端 Powerpoint(离线 Powerpoint)上运行流畅
这是它在控制台中显示的错误
powerpoint-web-16.00.js:26 Uncaught (in promise) RichApi.Error: Cannot read property 'invokePropertySet' of null
at new n (powerpoint-web-16.00.js:26)
at n.i.processRequestExecutorResponseMessage (powerpoint-web-16.00.js:26)
at powerpoint-web-16.00.js:26
感谢您报告此问题 - 此问题现已解决。
相关Githubpost:https://github.com/OfficeDev/office-js/issues/2071
这是我使用的代码
async function insertPptxFromBase64String(chosenFileBase64) {
Office.context.document.getSelectedDataAsync(Office.CoercionType.SlideRange, function (asyncResult) {
try {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {``
console.log(asyncResult.error.message);
} else {
const selectedSlideID = asyncResult.value.slides[0].id;
PowerPoint.run(async function(context) {
context.presentation.insertSlidesFromBase64(chosenFileBase64, {
formatting: "UseDestinationTheme",
targetSlideId: selectedSlideID + "#"
});
await context.sync();
});
}
}
catch (error) {
reject(console.log(error));
}
});
}
此代码选择当前所选幻灯片的幻灯片 ID,并在之后插入演示文稿。
它在两个平台上都运行完美,但大约一个月前,它停止了在线 Powerpoint(网络上的 powerpoint)的工作。它仍然在客户端 Powerpoint(离线 Powerpoint)上运行流畅
这是它在控制台中显示的错误
powerpoint-web-16.00.js:26 Uncaught (in promise) RichApi.Error: Cannot read property 'invokePropertySet' of null
at new n (powerpoint-web-16.00.js:26)
at n.i.processRequestExecutorResponseMessage (powerpoint-web-16.00.js:26)
at powerpoint-web-16.00.js:26
感谢您报告此问题 - 此问题现已解决。
相关Githubpost:https://github.com/OfficeDev/office-js/issues/2071