Jump to content
  • 0

Copy to clipboard button in a report list



Hello. I have a list report that I want to create a copy to clipboard button for a text area. Any suggestions on the code to copy to clipboard. I saw some code for tabbed report but I cannot seem to make that work.

Thank you very much :)

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

I don't know if this will serve your needs but I added a button on a report results screen so that the user can click a single button and it does a rich-text copy to their clipboard of all the content on the report results page.

Here's the simple HTML for the button:


<input id="clickMe" onclick="copyRichTextToClipboard();" type="button" value="Copy page content to clipboard" />

And here's the script that I put into the footer of that report page so that the button above can call the script.


function copyRichTextToClipboard() {
  // Create a range that encompasses the entire document
  const range = document.createRange();

  // Create a new selection and add the range to it
  const selection = window.getSelection();

  try {
    // Execute the copy command to copy the selected content with rich text format
    alert('Rich text content of the page has been copied to the clipboard.');
  } catch (error) {
    console.error('Copy to clipboard failed:', error);
    alert('Copying rich text to clipboard is not supported in this browser.');
  } finally {
    // Clear the selection



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...