web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Copying from rich text control using the copy function.

(0) ShareShare
ReportReport
Posted on by 16

I've been trying to copy from rich text control. 

Everything is fine when selecting and using CTRL+ C from the rich text control, then CTRL + V in other programs like MS Word.

 

Although if I try using a button using the copy function Ex:  on select: Copy(dcStem.HtmlText), then paste it into other programs, all the HTML tags are pasted, and MS Word or others do not apply the formatting.

Is it any way to emulate the CTRL+ C from the rich text control, I'm guessing the Copy function messes with the original encoding, and now MS Word assumes is plain text.

 

I have the same question (0)
  • Crash Profile Picture
    16 on at
    Re: Copying from rich text control using the copy function.

    The same thing happens if I use an HTML field.
    Copy(htmlQuestion.HtmlText)
    On paste at a Word document, the HTML format is pasted as plain text.

    I see many people reading but no one proposed a solution. I'm assuming this is a tough one.

  • vfn9zts Profile Picture
    4 on at
    Re: Copying from rich text control using the copy function.

    Strangely, if you copy and paste with your mouse or keyboard shortcuts, it pastes without the HTML tags.  It seems to be an issue with the Copy() function.  I am also looking for a solution using the Copy() function without HTML tags if anyone finds one, thank you in advance.

  • anthem47 Profile Picture
    14 on at
    Re: Copying from rich text control using the copy function.

    I had some luck just now by using Copy(PlainText(HtmlText1.HtmlText)) and then pasting the result into an Outlook email (also tested Excel). I am relieved but I have to admit it does feel a bit counterintuitive, like I would have thought "PlainText" by name would copy the text with the tags, in its plainest form. But oh well, I am not complaining!

  • btmgreg Profile Picture
    21 on at
    Re: Copying from rich text control using the copy function.

    Did you ever figure this out?

  • btmgreg Profile Picture
    21 on at
    Re: Copying from rich text control using the copy function.

    Thanks for the tip. I can't seem to replicate this. So my button originally has the onselect property of - 

    Copy(RichTextEditor2.HtmlText). The richtext editor has the property RichTextEditor2.
     
    I just changed it to 
    Copy(PlainText(RichTextEditor2.HtmlText)
     
    But the same result still happens. The code still displays in Outlook/Word/Whatever
     
    Any ideas?
  • anthem47 Profile Picture
    14 on at
    Re: Copying from rich text control using the copy function.

    Hmm, mine is definitely working - I just checked it again to be sure! But I did have a lot of issues in other ways getting this particular panel to function how I wanted it to as the data goes on a bit of a journey.

     

    For context, this is in a Canvas app. I have a 'create entry' screen where the users enters text into a Rich Text Editor (amongst other controls). They press a button that patches that content (and the rest of the data) to a row in a Sharepoint list. That column is a "multiple lines of text" type with "Use enriched text" set to off.

     

    There's then a 'main interface' screen with a gallery on the left that displays the contents of that list, and another rich text editor box on the right. Selecting an entry in the gallery sets a variable with the row ID. The rich text editor's Default is to Lookup the data in that "multiple lines of text" column from before using the row ID. Then finally, the Copy button has the Onselect we talked about - in my case Copy(PlainText(ET_ComplexViewer.HtmlText))

     

    And that, when I paste it into Outlook, works 😄 That was a long story but I thought high detail is important, there may be a subtle element here that explains the difference or inspires you to find the source of the problem. I was having issues where...I think one of the earlier controls or steps in the process was stripping out the 'richness' of the rich text, so all the steps further down the line were just treating it as regular text.

  • btmgreg Profile Picture
    21 on at
    Re: Copying from rich text control using the copy function.

    Interesting. Thank you for a really detailed writeup. This is basically exactly what I'm after. I want a gallery of rich text templates so my users can select a frequently used template and copy and paste to their destined program. 

     

    Do you think you'd be able to export the app your end and send it to me so I can have a play and modify? I'd be eternally greatful if you were able to. 

     

    Thank you 

  • anthem47 Profile Picture
    14 on at
    Re: Copying from rich text control using the copy function.

    Yes I'd be happy to! I'll send you a private message with a link as soon as I can.

  • Suggested answer
    AM-04120800-0 Profile Picture
    6 on at
    Copying from rich text control using the copy function.
    There is no way to do this directly in power apps outside of doing raw string manipulation of the HTML.  I need the same thing and am going to use an Automate flow or python Azure Function that just returns the rich text back which I'll then throw into Copy()

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 686 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 433 Super User 2025 Season 2

#3
wolenberg_ Profile Picture

wolenberg_ 266 Moderator

Last 30 days Overall leaderboard