Skip to main content

Notifications

Community site session details

Community site session details

Session Id : pzarioPPqmXdRANcLSLmlW
Power Apps - Microsoft Dataverse
Unanswered

convert rich text(html format) to plain text in power automate

Like (0) ShareShare
ReportReport
Posted on 9 Nov 2022 06:01:58 by 24

I have a requirement, I am using the rich text box in model-driven app forms, data is storing in data verse as HTML format is there any way to convert Html to plain text in power automate 

if I am using Html to text connector line breaks are not happening correctly

  • Community Power Platform Member Profile Picture
    on 05 Dec 2023 at 16:35:18
    Re: convert rich text(html format) to plain text in power automate

    Dear @satheeshreddy , did you solved this issue?

  • satheesh k Profile Picture
    24 on 10 Nov 2022 at 08:57:19
    Re: convert rich text(html format) to plain text in power automate

    hi @v-jefferni,

    I am working with model-driven apps, I have tried convert rich text to plain text but bullet points are missing.

     I am using the bellow code for the conversion

     

    function convertToPlain(html){

    // Create a new div element
    var tempDivElement = document.createElement("div");

    // Set the HTML content with the given value
    tempDivElement.innerHTML = html;

    // Retrieve the text property of the element
    return tempDivElement.textContent || tempDivElement.innerText || "";
    }

  • v-jefferni Profile Picture
    on 10 Nov 2022 at 08:29:56
    Re: convert rich text(html format) to plain text in power automate

    Hi @satheeshreddy ,

     

    It simply means copy your codes and paste into Initialize variable as well as Compose actions:

    vjefferni_0-1668067600205.pngvjefferni_1-1668067610327.png

     

    For your scenario, are you using RichTextEditor.HtmlText to populate the word template? Have you tried to use the PlainText function to convert the codes first, then use the plain texts to populate the template?

    vjefferni_3-1668068925937.png

     

    Best regards,

  • satheesh k Profile Picture
    24 on 10 Nov 2022 at 08:02:21
    Re: convert rich text(html format) to plain text in power automate

    Hi @v-jefferni ,

    can you please explain first and second steps which is 1) in a varaible 2) in compose

     

  • satheesh k Profile Picture
    24 on 10 Nov 2022 at 07:54:35
    Re: convert rich text(html format) to plain text in power automate

    hi @v-jefferni ,

    My actual scenario is  I have a rich text editor in PowerAPPs and we want to populate that text in a predifened MS word template using MS Flow. The rich text editor generates an html in the backend and if we simply populate that in MS word template then we see all the html tags.

    If we try to convert the html to text in Flow and then populate then the content looses all its formatting. means line breaks are not happening correctly

     

  • v-jefferni Profile Picture
    on 10 Nov 2022 at 07:51:14
    Re: convert rich text(html format) to plain text in power automate

    Hi @satheeshreddy ,

     

    I have tried and put the codes 1) in a variable, 2) in Compose, and 3) in HTML to Text directly, results are all the same and performs well:

    vjefferni_0-1668066497139.png

     

    Strange on your side. But please try and compose the codes first and use the outputs as the input parameter of HTML to Text.

     

    Best regards,

  • satheesh k Profile Picture
    24 on 10 Nov 2022 at 07:05:10
    Re: convert rich text(html format) to plain text in power automate

    Hi @v-jefferni ,

    <p><div data-wrapper="true" style="font-family:'Segoe UI','Helvetica Neue',sans-serif; font-size:9pt"><p style="background-color:#ffffff; border-color:initial; border-image-outset:initial; border-image-slice:initial; border-style:initial; border-width:0px; color:#000000; font-family:&quot;Segoe UI&quot;,SegoeUI,&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif; font-size:15px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; margin-bottom:0; margin-left:0; margin-right:0; margin-top:0; min-height:19px; padding:0px; text-align:start; text-decoration-color:initial; text-decoration-style:initial; text-decoration-thickness:initial; text-indent:0px; text-size-adjust:none; text-transform:none; vertical-align:top; white-space:normal; word-spacing:0px">Hello,</p>
    <p style="background-color:#ffffff; border-color:initial; border-image-outset:initial; border-image-slice:initial; border-style:initial; border-width:0px; color:#000000; font-family:&quot;Segoe UI&quot;,SegoeUI,&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif; font-size:15px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; margin-bottom:0; margin-left:0; margin-right:0; margin-top:0; min-height:19px; padding:0px; text-align:start; text-decoration-color:initial; text-decoration-style:initial; text-decoration-thickness:initial; text-indent:0px; text-size-adjust:none; text-transform:none; vertical-align:top; white-space:normal; word-spacing:0px">I've been working on a questionnaire where we want the user to be able to enter data into content controls and have the formatting be uniform throughout the form. We also needed the restrict the editing allowed to just these specific fields. I've placed rich text content controls in the document and have restricted editing to be Read only with the content controls as exceptions to the restriction.</p>
    <p style="background-color:#ffffff; border-color:initial; border-image-outset:initial; border-image-slice:initial; border-style:initial; border-width:0px; color:#000000; font-family:&quot;Segoe UI&quot;,SegoeUI,&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif; font-size:15px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; margin-bottom:0; margin-left:0; margin-right:0; margin-top:0; min-height:19px; padding:0px; text-align:start; text-decoration-color:initial; text-decoration-style:initial; text-decoration-thickness:initial; text-indent:0px; text-size-adjust:none; text-transform:none; vertical-align:top; white-space:normal; word-spacing:0px">Thank you so much!</p>
    <p style="background-color:#ffffff; border-color:initial; border-image-outset:initial; border-image-slice:initial; border-style:initial; border-width:0px; color:#000000; font-family:&quot;Segoe UI&quot;,SegoeUI,&quot;Helvetica Neue&quot;,Helvetica,Arial,sans-serif; font-size:15px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; margin-bottom:0; margin-left:0; margin-right:0; margin-top:0; min-height:19px; padding:0px; text-align:start; text-decoration-color:initial; text-decoration-style:initial; text-decoration-thickness:initial; text-indent:0px; text-size-adjust:none; text-transform:none; vertical-align:top; white-space:normal; word-spacing:0px">&nbsp;</p></div></p>

     

    I have given this html as input 

     

    Hello,

    I've been working on a questionnaire where we want the user to be able to enter
    data into content controls and have the formatting be uniform throughout the
    form. We also needed the restrict the editing allowed to just these specific
    fields. I've placed rich text content controls in the document and have
    restricted editing to be Read only with the content controls as exceptions to
    the restriction.

    Thank you so much!

     

    I got this out put, line breaks are not working properly 

  • v-jefferni Profile Picture
    on 09 Nov 2022 at 08:49:56
    Re: convert rich text(html format) to plain text in power automate

    Hi @satheeshreddy ,

     

    Could you please share some sample HTML code from you and the outputs of HTML to Text action in Power Automate? Since I used paragraph and line break tags and they worked fine:

    vjefferni_1-1667983753354.png

     

    Best regards,

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,731 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,077 Most Valuable Professional

Leaderboard

Featured topics

Loading started