
Is it possible to add a "Copy to Clipboard" using HTML text in PowerApps?
For displaying all my data from the gallery, I am using the HTML text label. I am able to change the font colors, font size, etc, added a Copy to Clipboard button inside the HTML text label, but I can't seem to figure out how to copy all text inside HTML text label.
<html>
<head>
<title>Copy Text to Clipboard</title>
<script>
function copyToClipboard() {
var textToCopy = 'Your text goes here';
var tempInput = document.createElement("input");
tempInput.setAttribute("value", textToCopy);
document.body.appendChild(tempInput);
tempInput.select();document.execCommand("copy");
document.body.removeChild(tempInput);
alert("Text copied to clipboard: " + textToCopy);
}
</script>
</head>
<body>
<!-- Create a button that triggers the copyToClipboard function when clicked -->
<button onclick="copyToClipboard()">Copy Text to Clipboard</button>
</body>
</html>
I don't believe the HTML text control supports the <script> tag, so consider using the Copy() function to achieve this.
Hope that helps,
Bryan