Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

text formatting for Create HTML action ( need to have a new line)

(0) ShareShare
ReportReport
Posted on by 62
Hi, 
I have enabled multiline for my text input and still my email body I won't gets the correct formatting for the text as it doesn't have the line breaks, as you can see in the output of the "create HTML for peepo" action it correctly shows how the text would be in the table,  but am not getting the result in email body.
 
 
  • Mark Nanneman Profile Picture
    Mark Nanneman 976 on at
    text formatting for Create HTML action ( need to have a new line)
    Glad it worked, @uchiha1234 !
  • uchiha1234 Profile Picture
    uchiha1234 62 on at
    text formatting for Create HTML action ( need to have a new line)
    it worked, nice trick, Thanks legend
  • Suggested answer
    Mark Nanneman Profile Picture
    Mark Nanneman 976 on at
    text formatting for Create HTML action ( need to have a new line)
    To format it so that you have page breaks in the final HTML in your email, you need to repalce the "New Line" ("\n") characters with HTML line breaks.

    Here's how you can do it.


    1. Save a "New Line" in a compose.

    Just make a compose, press enter to make a new line character, then name it.
    If you peak at code view, you'll see that this holds a "\n".  If you look at your multi line text values in your final HTML in a flow run, you'll see this same character .  We need to repalce it with "<br>"
     

    2.  Use Replace() to Replace all New Lines in your HTML Table with "<br>"

    You can add a compose after your HTML table action and write the replace function there.
    The expression looks like the following.  You are looking for every new line like the one in your "New Line" compose and replacing it with "<br>"
    replace(
    body('Create_HTML_table'),
    outputs('Compose_New_Line'),
    '<br>')


    3.  Put the Final Updated HTML in your Email

    Just reference the compose with the updated HTML.  Alternatively, you could put the code from the step above directly in the email body.

     

    The final email looks like this:
     


    If this helped you, please click "Does this answer your question" and give it a like to help others in the community (+ close the ticket)!

    Power Platform Developer | LinkedIn: Mark Nanneman | Blog: Power Stuff  | YouTube: Mark's Power Stuff  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,434

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,722

Leaderboard