OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
679 stars 95 forks source link

InsertInlinePictureFromBase64("base64Image, "replace") does not replace image #4053

Open A-Glazer opened 9 months ago

A-Glazer commented 9 months ago

When inserting an image into a selection using InsertInlinePictureFromBase64("base64Image, "Replace"), the image does not replace, it places it in on top of the selection.

Your Environment

Expected behavior

The image should replace the image inside the selection or place inside the selection frame.

Current behavior

Select an image on a Word document. Try inserting using insertInlinePictureFromBase64("base64Image, "Replace"). Instead of replacing the image in the selection, it places the new image on top of the selection or moves the image selected over.

Steps to reproduce

Select an image from the Word document. Place an image using:

Word.run(async (context) => {
    const selection = context.document.getSelection();
    selection.insertInlinePictureFromBase64(base64Image, "Replace");
    await context.sync();
  });

You will see the image places on top of the selection but does not replace the image.

Link to live example(s)

https://github.com/OfficeDev/office-js/assets/40736908/661de988-6b2b-4843-b86d-563ba08f2bb3

microsoft-github-policy-service[bot] commented 9 months ago

Thank you for letting us know about this issue. We will take a look shortly. Thanks.