Cannot paste tabs into excel or google docs in v.8

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9655
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Cannot paste tabs into excel or google docs in v.8

Post by dunbarx » Sat Feb 03, 2018 6:30 am

Jacque posted this on the use list. Similar subject title.

In v.8, tabs are not recognized by excel or google docs, and likely not by any "spreadsheet" that is built in the usual way.

Code: Select all

 set the clipBoardData to "X" & tab & "Y" & tab & "Z"
Then try to paste into excel. You get "X Y Z" in a single cell, as if the tab (ASCII 9) characters were replaced, perhaps, with spaces. This is not the case with earlier versions of LC. And inside LC 8 itself, there is no issue pasting that string, formatted as advertised, into, say, a table field.

How do it know?

I am just reporting what Jacque has already posted. But this is a big bug.


Craig
Last edited by dunbarx on Sat Feb 03, 2018 5:32 pm, edited 1 time in total.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Cannot paste tabs into excel or google docs in v.8

Post by bogs » Sat Feb 03, 2018 6:53 am

Well, I found 2 things. Using Libre Office (linux), if you choose edit -> paste, then indeed it winds up in one cell.

If you use edit -> paste special -> unformatted text, then it puts it into 3 separate cells.
Image
Unfortunately, I don't know the answer to your question.
Image

matthiasr
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 190
Joined: Sat Apr 08, 2006 7:55 am
Location: Lübbecke, Germany
Contact:

Re: Cannot paste tabs into excel or google docs in v.8

Post by matthiasr » Sat Feb 03, 2018 8:53 am

Hi,

i´ve posted a reply to your post in the mailing list already. But to keep this discussion here current:

i cannot reproduce that here on Mac OS X and Excel 2016 (V 15.30).
I executed your sample code in the messagebox and was able to paste successfully the clipboard to Excel.
I even tried with alpha numeric values.

But what i noticed is the following:
When i just click on a cell, so that it is selected without showing the blinking write cursor in the cell, then pasting is working w/o problems.

When i double click a cell, so that it is selected and the blinking write cursor is shown, then i cannot paste it correctly.

Tried with LC 8.19RC2 and LC9DP11.

Will try on Windows later this day.


Regards,
Matthias

bwmilby
Posts: 439
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Cannot paste tabs into excel or google docs in v.8

Post by bwmilby » Sat Feb 03, 2018 10:45 pm

I also can't replicate this on Win10. I even added a second line (cr) and got the extra line but still went into multiple columns as long as a cell was selected (no insertion point cursor). As soon as you are inside a cell, everything pastes into that cell though. I tested with DP11, Excel 13.

I've also written a bit on the list thread.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9655
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Cannot paste tabs into excel or google docs in v.8

Post by dunbarx » Sat Feb 03, 2018 11:19 pm

I must backpedal just a little.

The original post on the use list stated that both Excel and a spreadsheet in Google Docs exhibited this behavior. I never actually tested Excel, only Google docs.

But in Googole Docs, as stated, and I understand the difference between a merely selected cell and one with a blinking cursor, I can go back and forth all day between v. 6.7.8 and v. 8.1.8, and the v.6 paste distributes over three cells, and the v.8 paste fills the selected cell.

Will check Excel soon.

Craig

bwmilby
Posts: 439
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Cannot paste tabs into excel or google docs in v.8

Post by bwmilby » Sun Feb 04, 2018 1:24 am

PR 6293 should correct this issue (bug 19206). When plain text is copied to the clipboard, styled text will not be added.

Here's a function that can be used to prep the clipboard for text-only use outside LC:

Code: Select all

on makeClipboardPlainText
   local tClip, tRawType
   
   if the platform is "MacOS" then
      put "public.utf8-plain-text" into tRawType   -- OSX
   else if the platform is "Linux" then
      put "text/plain;charset=utf-8" into tRawType -- Linux
   else if the platform contains "Win" then
      put "CF_UNICODE" into tRawType -- Windows
   end if
   
   lock the clipBoard
   put the rawClipboardData[tRawType] into tClip
   set the rawClipboardData to empty
   set the rawClipboardData[tRawType] to tClip
   unlock the clipBoard
end makeClipboardPlainText
To use, place the information on the clipboard as usual. Call this handler before using the clipboard data outside of LC.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

bwmilby
Posts: 439
Joined: Wed Jun 07, 2017 5:37 am
Location: Henrico, VA
Contact:

Re: Cannot paste tabs into excel or google docs in v.8

Post by bwmilby » Mon Feb 05, 2018 3:44 am

I've placed this function and one other in a file located here:
https://github.com/bwmilby/lc-misc/tree ... oardHelper

updateClipboardHtmlText will take the HTMLText that is on the clipboard and change the tags so that it will paste better into other applications. It won't do anything about the above tab issue, but it does address the extra line issue and missing spaces.

I figure GitHub is a better place for pieces of code like this so that if I make any updates, they will be generally available.
Brian Milby

Script Tracker https://github.com/bwmilby/scriptTracker

Post Reply

Return to “Talking LiveCode”