Get the current selection on PowerPoint Add-In
Samuel Monteiro
1
Reputation point
I'm developing a Add-in for PowerPoint that inserts images in the document.
I'm currently able to insert the image, but what I'm not able to do is to replace a current selected image.
So, for example, imagine that
- The user added an image available on the Add-in, inside an empty slide
- He then selected this image and wants to replace it with another one also available on the Add-in
- He clicks/selects the slide image, and then clicks on the image inside the Add-in that he wants to replace.
But I'm not able to get his selection with the Office API.
Can someone help me?
My current code is like this:
const insertFile = (binaryStr: string) => {
const dataOptions = {
coercionType: Office.CoercionType.Image,
};
Office.context.document.setSelectedDataAsync(binaryStr, dataOptions, (result) => {
if (result.status === Office.AsyncResultStatus.Failed) {
console.error(result.error.message);
}
});
};
Sign in to answer