Office script to copy table image copies 'wrong' format

Salazar, Jaime 21 Reputation points
2021-09-10T09:32:08.573+00:00

Hi,

I'm not sure if this is the place to report what I think is a bug in a function. In Power Automate, I am copying a table image from an Excel file into the body of an email. In order to do that, I have used the script I found here: https://learn.microsoft.com/en-us/office/dev/scripts/resources/samples/email-images-chart-table

Specifically, under the section for Sample code: Calculate and extract Excel chart and table, I'm finding the line const tableImage = table.getRange().getImage();.

The Excel file contains the cells B9 and G9 where the text is properly wrapped:
131018-correct.jpg

However, this gets copied into the email body with what appears to be unwrapped text:
131091-incorrect.jpg

Is there something I can add to my script to keep the original, correct formatting? Or is this a bug in the Range.getImage() function?

Thank you

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,459 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. AlexJerabek 81 Reputation points Microsoft Employee
    2021-09-27T16:58:25.48+00:00

    Hi @Salazar, Jaime ,

    Thank you for reporting this issue. This does appear to be a bug in the Excel for the web implementation of this API (which affects Office Scripts). We are investigating a fix.

    1 person found this answer helpful.

  2. Cristiane Ricci 6 Reputation points
    2022-10-13T18:18:54.343+00:00

    I'm facing the same issue, is there a solution yet?

    1 person found this answer helpful.
    0 comments No comments