cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ikmalfikri
Helper I
Helper I

How to attach the docx similar to image?

Hi,

 

I have a question about PowerAutomate..So I have a docx template where the field will be fill with data.Now i want to send the email with the docx but not as attachment but similar to inserting image to the mail where it will be opened already and user can view the content instead of have to open the docx. Is there a way to do this?

 

I have tried converting the document to image and save it to OneDrive, but then, i can't use <img src=''> because create a file did not provide link instead only directory..

 

Thank you

10 REPLIES 10
Jay-Encodian
Community Champion
Community Champion

Hey @ikmalfikri 

If I've understood this correctly, your trying to:

1) Populate a word document with some data

2) Convert word document to an image

3) Embed the resulting image into an email and send

Is that correct? and if so can you confirm how many pages are in the source word document?

Jay

Yes, only 1 page document.

Hey @ikmalfikri 

This is a little convoluted... but this approach would work.

1) Convert the Word Document to a PDF

2) Extract the first page of the Word Document as an Image

3) Resize the image

4) Upload the image to storage

5) Build the HTML Email

6) Send the email

NOTE: Email clients like Outlook do not support DataUri's so that is why you need to upload the image file to storage.

Here is the flow:

1.jpg

Here is the output:

2.jpg

JSON for Image Extraction:

[
{
"Name": "FirstPage",
"LowerLeftXCoordinate": 0,
"LowerLeftYCoordinate": 0,
"UpperRightXCoordinate": 0,
"UpperRightYCoordinate": 0,
"PageNumber": 1,
"ImageType": "PNG",
"ExtractEntirePage": true,
"Resolution": 300
}
]

Expressions (in order):

first(outputs('Extract_Images_from_PDF')?['body/Images'])?['Filename']

first(outputs('Extract_Images_from_PDF')?['body/Images'])?['FileContent']

HTH

Jay

is there a free option?within Microsoft platform

@ikmalfikri - let me check

Encodian provide a free Sku which allows 50 actions per month

I Have done;

Convert to PDF

Convert to Image

Save to OneDrive

Create Share Link
But the create share link didn't work in Mail..even using img src

@ikmalfikri  - yes, I'm just checking this approach to

@ikmalfikri  - sorry, I'd forgotten the OneDrive action will convert the first page of a document to a JPG 🙂

Here is a simplified version, no need for Encodian (Unless you need to resize the image)

NOTE: A share link will not work... you have to create a direct URL to the image.

1.jpg

HTH

Jay

 

Thank you..I will try it..
Is blob free btw?
Very sorry but the current flow i'm working on require no additional cost...

If not just wondering is there any other solution?beside sharepoint as i think sharepoint may work

@ikmalfikri - The Azure storage connector is premium... but still part of the platform. If you don't have access to premium you'll need to the files somewhere else.

Just bear in mind that where ever these files are stored the user received the email must have access to the file... if it's internal users you could try a SharePoint URL.... but if it's external users it must be a storage location which enables anonymous access to the file. Sharing links will not work as they perform redirects

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (4,765)