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
Dear @satheeshreddy , did you solved this issue?
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 || "";
}
Hi @satheeshreddy ,
It simply means copy your codes and paste into Initialize variable as well as Compose actions:
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?
Best regards,
Hi @v-jefferni ,
can you please explain first and second steps which is 1) in a varaible 2) in compose
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
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:
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,
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:"Segoe UI",SegoeUI,"Helvetica Neue",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:"Segoe UI",SegoeUI,"Helvetica Neue",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:"Segoe UI",SegoeUI,"Helvetica Neue",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:"Segoe UI",SegoeUI,"Helvetica Neue",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"> </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
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:
Best regards,
WarrenBelz
146,731
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,077
Most Valuable Professional