Pasting tabs into Excel

Brian Milby brian at milby7.com
Sat Feb 3 13:23:43 EST 2018


I don’t think it changed. But Excel currently supports tab and return
characters within cells. If you paste text with tabs/returns into the
formula bar area it will all go into that cell.  I'm using Excel 16.9
(180116)

Try this function (LC 8/9):

*on* stripClipboard
   *local* tData
   *lock* the clipboard
   *put* the rawClipboardData["public.utf8-plain-text"] into tData
   *set* the rawClipboardData to empty
   *set* the rawClipboardData["public.utf8-plain-text"] to tData
   *unlock* the clipboard
*end* stripClipboard

This will ensure the only thing on the clipboard is the text format (no RTF
and no HTML).  Even when I use this function after putting the text on the
clipboard, I get the same results.  And I get the same in LC 6 & 7 too.

You mentioned raw clipboard, what did you try there?

Oddly, when I use the text to columns tool, it recognizes the tabs (when I
pasted the text into a single cell).


More info on those 2 bugs:

The first bug is about LC placing too much on the system clipboard.  Prior
to 8, LC only put text+RTF on the clipboard.  With 8, HTML was added - LC
ran everything through its internal conversion to LC styled text and put LC
HTMLtext on the system clipboard as HTML.  The bug fix on the first on
stops that conversion so that when plain text is placed on the clipboard,
only plain text is put on the system clipboard (and it no longer puts
anything styled).

The second bug is tightly related.  It is actually the same process that is
causing the problem, but the solution will be slightly different.  There
isn't a PR on this one yet.  It would be easy to disable LC HTMLtext going
to the clipboard unless specifically requested (which would be more like
pre LC-8), but fixing the actual HTMLtext is a little more complicated.
I've written some LCS code that can convert HTMLtext into a format that
works (mostly) with copy/paste to other apps, but have not figured out how
to put that into the message path to work seamlessly (would need to be
called from the engine copy code).  Ideally, something like:
set the fullclipboarddata["htmltext"] to the htmltext of field "test"
would put something on the clipboard that would not render with all of the
extra lines and missing spaces when pasted to other apps.

Thanks,
Brian



More information about the use-livecode mailing list