Please allow developers to set extended object attributes in extensions

Please allow developers to set extended object attributes in extensions
0

Upvotes

Upvote

 Nov 24 2023
0 Comments 
New

I have built an extension that adds images to PowerPoint. It works just fine. Now, I want to add Alt Text to the image when inserting the image. I don't see any option for that in the documentation.

I did try the following, and it (as expected!) did not work.

export const insertImage = async (image) => {
  // insert the image into the document.
  try {
    Office.context.document.setSelectedDataAsync(
      image,
      {
        coercionType: Office.CoercionType.Image,
        altText: "alt text test",
      },
      (asyncResult) => {
        if (asyncResult.status === Office.AsyncResultStatus.Failed) {
          throw asyncResult.error.message;
        }
      }
    );
  } catch (error) {
    console.log("Error: " + error);
  }
};

Can you please create an interface so that we can inject additional attributes onto objects?