Open Jayshiv1408Dev opened 2 months ago
HI @Jayshiv1408Dev - have you tried this? https://learn.microsoft.com/en-us/office/dev/add-ins/powerpoint/powerpoint-add-ins#navigate-to-a-particular-slide-in-the-presentation
Thanks @EsterBergen I'll try this. https://learn.microsoft.com/en-us/javascript/api/office/office.document?view=common-js-preview#office-office-document-getselecteddataasync-member(1)
I check that earlier it's showing in preview stage.
HI @Jayshiv1408Dev - have you tried this? https://learn.microsoft.com/en-us/office/dev/add-ins/powerpoint/powerpoint-add-ins#navigate-to-a-particular-slide-in-the-presentation
I tried but it's not Redirecting. Here is my code snippet. If I'm making some mistake please let me know.
Here is my CDN
async function makeSlideActive1(slideIndex) {
var Globals = { activeViewHandler: 0, firstSlideId: 0 }
PowerPoint.run(async context => {
const presentation = context.presentation;
const slides = presentation.slides;
slides.load("items");
await context.sync();
if (slideIndex < 0 || slideIndex >= slides.items.length) {
console.error("Slide index out of range.");
return;
}
const slideId = slides.items[slideIndex].id;
Globals.firstSlideId = slideId;
Office.context.document.getSelectedDataAsync(Office.CoercionType.SlideRange, function (asyncResult) {
if (asyncResult.status == "failed") {
app.showNotification("Action failed with error: " + asyncResult.error.message);
}
else {
Globals.firstSlideId = slideId;
app.showNotification(JSON.stringify(asyncResult.value));
}
});
});
}
It should work if you follow this guidance @Jayshiv1408Dev .
My Environment Platform : PC desktop Host: Power Point Office version number: Microsoft® PowerPoint® for Microsoft 365 MSO (Version 2404 Build 16.0.17531.20140) 64-bit Operating System: Windows 11 pro
I want to redirect to slide base on index number. Currently I'm on slide 10(index: 9) and want to jump on slide 1(index: 0) Is there way I can achieve it? Base on this Other Problem is also solved. Here is my use case for redirect issue.
Inserting Image using this code snippet.
This Code inserting image on Active slide.I want to Insert image on other slide base on slide index. Is there way I can insert image on slide using Index number Or I can make that slide active(Selected) and Then insert image on it.