Clipboard extension cannot copy colored, bold, or italic text?

How would I copy bold, italic, and/or colored text using the clipboard extension? I tried copying text from a text box with the BOLD and ITALIC check boxes checked, but that failed. I'm new to App Inventor, so can I get a helping hand?

The only way I know is that is you can copy the the text as HTML. If you want to copy the text - "Hello" with italic then you have to copy text like this - <i>Hello</i>.

Note: If you are pasting the text, the app or program should accept HTML.

do you use this extension :

I think you should try to use this method :

1 Like

Hello Cesar

If you are using copy-paste from your App to another App, it is usually the case that formating and colour do not get copied by the Android System. There are of course exceptions to most rules but it can become messy to accommodate them - is your App only ever copying to one other specific App? If that is the case, you might have a chance of preserving the text decoration.

On the other hand, if you are copying and pasting within your own App, you can use your own non-displayed codes to preserve decoration. That is still a complex task though. If preserving formatting only (Bold, Italic), but not colour, then Unicode comes into play, but Android isn't as good as the likes of Windows, MacOS and Linux.

This might be of interest:

I guess I should've more context about the app. The program I'm creating will be able to change the text the user inputs into a textbox to a bunch of different formats (UPPERCASE, bold, cRiNgE, etc.). The user will be able to copy this new formatted text and paste it wherever the user needs it.

I am using that extension! What are the limits in terms of formatting the text that the second method provides? Would bold, italics, or different-colored text transfer well to other webpages or apps?

Nice! I see that different systems have trouble copying and pasting bold and italics from what the site shows, but other text formats work better. Could I use the website you suggested directly to format some text from my app somehow, and then copy the text from the website for the user?

Hi Cesar

That's a private website, so no you can't use it for your App.

That is going to be a tough ask, given that the standard clipboard does not support text decoration, so your copy-paste notion just won't work.

What you would have to do is pass a formatted file to the "other" App. So for example, if your User wanted to transfer the text to MS Word, you would need to create a .docx file and share it with Word.

I think you should try it

While you can't use that site, you could use in a webview, and use the webview string and runjavascript functions to do the formatting.

1 Like

Can you please provide an example of a javascipt function I can input into the runjavascript block? I don't know how to write in javascript nor how to use that block.

Also, the vitality of my app may or may not depend on it... No pressure!


The formatting is not the problem, there are a variety of ways to do it - but the receiving App has to support the formatting and so does the Clipboard. So really, your App would need to become a "super plus clipboard" that recognises the formatting of popular Apps and can copy-paste to them. I think that is beyond App Inventor unless you make an extension to perform the task - might be better in this instance to define an App in Android Studio and build it to support Android Background Services for availability, like the default Clipboard.

Here is an example app that uses javascript to copy italic and bold text. Sorry, it is pretty complicated.
TextFormat.aia (6.5 KB)

Sorry apk removed by moderator. You are not allowed to post apk files here.