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
674 stars 95 forks source link

getSelectedShapes() returning an empty array sometimes even when a shape is selected in the Slide #4222

Open nikhilatsap opened 7 months ago

nikhilatsap commented 7 months ago

Provide required information needed to triage your issue

Your Environment

Expected behavior

getSelectedShapes() should return the array of selected shapes.

Current behavior

Currently it is returning an empty array of shapes even when one or more shapes are selected in the slide or PPT

Steps to reproduce

The API shapes.items sometimes returns empty array. It should always return 1 object, as we are copying the image and only after the image is added to the slide, we are calling the API getSelectedShapes() and it should always return 1 item selected. Because of this we are not able to do some post processing on the image which is added to the slide.

Office.context.document.setSelectedDataAsync(dataUrl.slice(dataUrl.indexOf(",") + 1), options, async (result) => { if (result.status !== Office.AsyncResultStatus.Failed) { await PowerPoint.run(async (context) => { const shapes = await context.presentation.getSelectedShapes(); shapes.load("items"); await context.sync(); } } }

Provide additional details




Context

Useful logs

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

AkhileshShah-MS commented 7 months ago

Hi @nikhilatsap ! Thanks for reaching out to us. Looping in @EsterBergen to help with the issue. Thanks!

akrantz commented 7 months ago

I am wondering if there is an issue in the code with async/await leading to the unexpected state where there isn't a selection when you think there should be one.

I usually try to not intermix callback code with async function code because it can be easy to make a mistake. I write an async function wrapper for the callback code so that the calling code is just regular async functions.

Here's a ScriptLab sample you can import into PowerPoint and try. I'm not able to reproduce any problems with the selection but perhaps this can help uncover the source of the problem you are having. If you can find a reproducible scenario and can share back a ScriptLab example, it would be very helpful.

In this example, the async function setSelectedData(text: string): Promise<void> wraps setSelectedDataAsync().

It would be good to know if using this approach helps with your problem.

name: Get selected items after setSelectedDataAsync()
description: Call setSelectedDataAsync() and then get the selected items.
host: POWERPOINT
api_set: {}
script:
  content: |
    $("#run").on("click", run);

    async function run() {
      try {
        await setSelectedData("This is a test");

        await PowerPoint.run(async (context) => {
          const selectedShapes = context.presentation.getSelectedShapes();
          selectedShapes.load("items");
          await context.sync();

          console.log(`${selectedShapes.items.length} shapes are selected`);
        })
      } catch (err) {
        console.error(`ERROR: ${err}`);
      }
    }

    async function setSelectedData(text: string): Promise<void> {
      return new Promise((resolve, reject) => {
        Office.context.document.setSelectedDataAsync(text, {}, (result) => {
          if (result.status === Office.AsyncResultStatus.Succeeded) {
            resolve();
          } else {
            reject(result.error);
          }
        });
      });
    }
  language: typescript
template:
  content: |-
    <button id="run" class="ms-Button">
        <span class="ms-Button-label">Run</span>
    </button>
  language: html
style:
  content: |-
    section.samples {
        margin-top: 20px;
    }

    section.samples .ms-Button, section.setup .ms-Button {
        display: block;
        margin-bottom: 5px;
        margin-left: 20px;
        min-width: 80px;
    }
  language: css
libraries: |
  https://appsforoffice.microsoft.com/lib/1/hosted/office.js
  @types/office-js

  office-ui-fabric-js@1.4.0/dist/css/fabric.min.css
  office-ui-fabric-js@1.4.0/dist/css/fabric.components.min.css

  core-js@2.4.1/client/core.min.js
  @types/core-js

  jquery@3.1.1
  @types/jquery@3.3.1
akrantz commented 7 months ago

I did find one example where there are zero shapes selected. If I go to the Slide Master view (Slide Master button on View menu), and then run the code, it will report zero shapes selected.

This is "by design" in that the support for selected shapes is only on the presentation slides, and slide masters are different than slides, so you can use SetSelectedDataAsync() to insert or modify a shape, and that shape is selected, but that's not considered a selected shape in the API since the shape isn't on a presentation slide.

nijain commented 7 months ago

Hi Akrantz,

Thanks for responding, We tried with the code you suggested. With this code we never got any items in the getSelectedShape() (after loading the items) However if we add a breakpoint in getSelectedShapes() and debug thru the lines, it always returns 1 item in the object selectedShapes.items.

below is our code :

const addImageToCurrentSlide = async(imgText: string, options: optionType): Promise => { return new Promise((resolve, reject) => { Office.context.document.setSelectedDataAsync(imgText, options, (result) => { if (result.status === Office.AsyncResultStatus.Succeeded) { resolve(); } else { reject(result.error); } }); }); }

const pasteImageToPPT = async ( dataUrl: string, widgetDetails: widgetDetails, imageDimensions?: imageDimensionsType, sheetId?: string ) => { let options: optionType = { coercionType: Office.CoercionType.Image, }; if (imageDimensions?.width) { options = { ...options, imageHeight: imageDimensions.height, imageWidth: imageDimensions.width, imageTop: imageDimensions.top, imageLeft: imageDimensions.left, }; } await addImageToCurrentSlide(dataUrl.slice(dataUrl.indexOf(",") + 1), options); await PowerPoint.run(async (context) => { const shapes = await (context.presentation as any).getSelectedShapes(); shapes.load("items"); await context.sync(); // Only string formats can be appended to the tags of a shape shapes.items.map(async (shape: any) => { shape.name = SACWidget_${widgetDetails.RESOURCEID}_${widgetDetails.WIDGETID}_${widgetDetails.TENANT}; shape.tags.add("uniqueId", widgetDetails.UNIQUEID ? widgetDetails.UNIQUEID : generateUniqueId()); shape.tags.add("resourceTitle", widgetDetails.RESOURCETITLE); shape.tags.add("widgetType", widgetDetails.WIDGETTYPE); shape.tags.add("widgetName", widgetDetails.WIDGETNAME); shape.tags.add("lastRefresh", getCurrentTimestamp()); shape.tags.add("resourceId", widgetDetails.RESOURCEID); shape.tags.add("widgetId", widgetDetails.WIDGETID); shape.tags.add("tenant", widgetDetails.TENANT); shape.tags.add("bookmark", widgetDetails.BOOKMARK); shape.tags.add( "containerWidth", widgetDetails.WIDGETCONTAINER.getBoundingClientRect().width.toString() ); await context.sync(); }) }); };

akrantz commented 7 months ago

When a shape is added to the slide, rather than try to get the selected item, you can just get the last shape in the slide.shapes collection. Here is code which will add an image to the current slide and return the added shape.

async function addImage(imageDataBase64: string, options?: PowerPoint.ShapeAddOptions): Promise<PowerPoint.Shape> {
  return new Promise((resolve, reject) => {
    Office.context.document.setSelectedDataAsync(imageDataBase64, 
      {
        ...options,
        coercionType: "image",
      },
      async function(asyncResult) {
        if (asyncResult.status === Office.AsyncResultStatus.Failed) {
          reject(asyncResult.error);
        }

        await PowerPoint.run(async (context) => {
          const slide = context.presentation.getSelectedSlides().getItemAt(0);
          slide.shapes.load();
          await context.sync();

          const shape = slide.shapes.items[slide.shapes.items.length - 1];
          shape.load();
          await context.sync();

          resolve(shape);
        });
      }
    );
  });
}

I tested this using this code, which inserts a shape and then moves it after it is added.

async function run() {
  const imageData = getImageData();
  const shape = await addImage(imageData, { left: 50, top: 50 });
  console.log(`Shape ${shape.id} added.`);

  PowerPoint.run(async (context) => {    
    shape.top = 300;
    shape.left =100;
    await context.sync();
    console.log(`Shape ${shape.id} moved.`);
  });
}

and for completeness, here the function which returns some image data:

function getImageData() {
  return "iVBORw0KGgoAAAANSUhEUgAAAZAAAAEFCAIAAABCdiZrAAAACXBIWXMAAAsSAAALEgHS3X78AAAbX0lEQVR42u2da2xb53nH/xIpmpRMkZQs2mZkkb7UV3lifFnmNYnorO3SLYUVpFjQYoloYA3SoZjVZRi2AVtptF+GNTUzbGiwDQu9deg2pCg9FE3aYQ3lDssw2zGNKc5lUUr6ItuULZKiJUoyJe2DFFsXXs6VOpf/D/kS6/Ac6T2Hv/M8z3nf5zTMz8+DEEL0QCOHgBBCYRFCCIVFCKGwCCGEwiKEEAqLEEJhEUIIhUUIIRQWIYTCIoQQCosQQigsQgiFRQghFBYhhFBYhBAKixBC1hArh2CBwtlYaTRV6ac2f7Cx2Q3AsTfEsSKEwlprYQ3Gpt4bFLixfU+vpdltCwTte0JNHQFrR4ADSEgdaGCL5AVGvhkSLqyV1t/gd+wN2feGHHtClBchFJbq3Hq5b+LCGfn7sfl7nI+HWw710VyEUFhqkf1BJPuDkwrusOXgsfW94ZZDfRxb8oBCEpn4yn90BmF1ozUIq5sjVCOb4RCoxMSFMxMXzlg3+D1fjDgfD3NAzE4ph6EwMlWjeKsLziDaQvCE0BbimDHCquyX8/Fb33lapZ3b9/RueD5q8wc5zuYl2VfDVqvx9MLbB28fHCwvUFjLmUknr/3xw6oewvPMNzzPRDjUZmQsgfNHpX/cewzePvgYp1NYS/j4yw1qH8K+p3fTS/GFKV3ERLw/gCuvyN2Jww9fGP4BM5e6ONP9ATZ/j9qHmHpvcOS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
nijain commented 7 months ago

Tried the new way of retrieving the newly added shape....it works all the time. Will give it to testing team to check rigorously and confirm. Thanks for the new solution. Will get back again in a couple of days.

nijain commented 7 months ago

hi Akrantz, testing team did the testing and they are still able to reproduce the issue. And this time it was more frequent as compared to our initial code.

akrantz commented 7 months ago

Interesting. Can you share repro steps?

EsterBergen commented 4 months ago

@nijain - can you provide the repro steps for @akrantz ?

nikhilatsap commented 4 months ago

Hi Team, the reproduction steps and the code is already provided by @nijain above in comment that is the same code that we are still using. The issue is less frequent and appears only once in a while. The probability of it occurring is 10-15%. We have already given the functions we using to add the image to the slide using the setSelectedDataasync() and then the function to add tags to the added image where we use the getSelectedShapes() which we use to get the image to add tags to it. If you need anything further please let me know. The only difference I can see is that we have a bunch of promises and async- awaits. But right now I don't see any reason why that should cause any problem in getSelectedShapes() returning empty.

EsterBergen commented 4 months ago

@akrantz - Any thoughts given the repro steps?