Concatenation

How to concatenate several cells (numbers) where one at least contains underlined text. I want to keep the text format after concatenating

MacBook Pro 15", macOS 10.14

Posted on Mar 27, 2019 3:09 AM

Reply
Question marked as Top-ranking reply

Posted on Mar 28, 2019 3:36 AM

You can try this:




The formula in E2:


=CONCATENATE("<html>",A2," ","<b>",B2,"</b>"," ","<i>",C2,"</i>"," ","<span style=","""","text-decoration:underline"">",D2,"</span>","</html>")


The formula marks up the text as html. The script converts that html to rich text format and places it on the clipboard. Select the cell with the concatenated html and command-c to copy. Then run the script by clicking the triangle 'run' button in Script Editor (make sure Script Editor and Numbers.app are listed and checked at System Preferences > Security & Privacy > Privacy > Accessibility. After running the script select the Numbers cell where you want it (I chose F2) and command-v to paste.


The script to copy-paste into Script Editor (in Applications > Utilities). Be sure to copy-paste the whole thing (it scrolls off to the right):


set theHTML to the clipboard as text
set theRTF to do shell script "echo " & theHTML's quoted form & " | textutil -convert rtf -stdin -stdout | pbcopy"




SG

4 replies
Question marked as Top-ranking reply

Mar 28, 2019 3:36 AM in response to mllacroix

You can try this:




The formula in E2:


=CONCATENATE("<html>",A2," ","<b>",B2,"</b>"," ","<i>",C2,"</i>"," ","<span style=","""","text-decoration:underline"">",D2,"</span>","</html>")


The formula marks up the text as html. The script converts that html to rich text format and places it on the clipboard. Select the cell with the concatenated html and command-c to copy. Then run the script by clicking the triangle 'run' button in Script Editor (make sure Script Editor and Numbers.app are listed and checked at System Preferences > Security & Privacy > Privacy > Accessibility. After running the script select the Numbers cell where you want it (I chose F2) and command-v to paste.


The script to copy-paste into Script Editor (in Applications > Utilities). Be sure to copy-paste the whole thing (it scrolls off to the right):


set theHTML to the clipboard as text
set theRTF to do shell script "echo " & theHTML's quoted form & " | textutil -convert rtf -stdin -stdout | pbcopy"




SG

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Concatenation

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.