Skip to main content

Notifications

Community site session details

Community site session details

Session Id : W0nHTJGVJbURyj/KPFOi6N
Power Apps - Building Power Apps
Unanswered

Copying from rich text control using the copy function.

Like (0) ShareShare
ReportReport
Posted on 7 Aug 2023 11:29:14 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.

 

  • Suggested answer
    AM-04120800-0 Profile Picture
    2 on 04 Dec 2024 at 08:01:37
    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()
  • anthem47 Profile Picture
    14 on 19 May 2024 at 23:52:35
    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.

  • btmgreg Profile Picture
    21 on 17 May 2024 at 14:10:19
    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 17 May 2024 at 04:52:12
    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 15 May 2024 at 12:55:03
    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?
  • btmgreg Profile Picture
    21 on 15 May 2024 at 12:51:15
    Re: Copying from rich text control using the copy function.

    Did you ever figure this out?

  • anthem47 Profile Picture
    14 on 14 May 2024 at 01:23:01
    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!

  • vfn9zts Profile Picture
    4 on 01 May 2024 at 16:32:13
    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.

  • Crash Profile Picture
    16 on 09 Aug 2023 at 10:50:47
    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.

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…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Building Power Apps

#1
MS.Ragavendar Profile Picture

MS.Ragavendar 10

#2
LC-26081402-0 Profile Picture

LC-26081402-0 6

#3
EE-04041031-0 Profile Picture

EE-04041031-0 4

Overall leaderboard