Paste column into grid
Paste column into grid
I'd like to copy a column from Excel to clipboad and paste it into a column in Dyalog grid starting from a selected cell. But it is transposed to a row. Only when the target region in the grid is preselected it goes to the wrigth place. Is it possible to change this default Excel -> Dyalog grid pasting method? Thanks in advance!
Re: Paste column into grid
Presumably it's not. When you inspect the clipboard after the copy you will find that there is no way to tell whether the data is a column or a row. Nothing you can do about this. Well, you could start pestering Bill...
Re: Paste column into grid
When an application copies data into the clipboard it may provide the data in several formats simultaneously. Every application is allowed to add data to the clipboard in it's own proprietary format, or even in several formats, containing more or less information. At least the application's programmers have the choice to do so.
So data you find in the clipboard may or may not contain shape information. The only clipboard format common to (almost) all applications is plain text. This format does not know about columns.
Of course, in Excel an additional proprietary clipboard data format is provided, so a user of Excel can copy data from one instance of Excel to the next instance of Excel in a way that preserves shape. For this purpose, Excel simply has to first check the clipboard for data in it's own proprietary format.
The challenge for an application that wants to paste data from the clipboard is to guess which of the data formats provided in the clipboard at the moment is most appropriate.
So data you find in the clipboard may or may not contain shape information. The only clipboard format common to (almost) all applications is plain text. This format does not know about columns.
Of course, in Excel an additional proprietary clipboard data format is provided, so a user of Excel can copy data from one instance of Excel to the next instance of Excel in a way that preserves shape. For this purpose, Excel simply has to first check the clipboard for data in it's own proprietary format.
The challenge for an application that wants to paste data from the clipboard is to guess which of the data formats provided in the clipboard at the moment is most appropriate.
Re: Paste column into grid
Although Uwe is correct in what he's saying it might be misleading:
The information in which formats data is available on the clipboard is provided by the "Formats" property. Naturally, Dyalog only supports standard formats. So any proprietary formats left behind by any other application is not available to an APL programmer, at least not without []NA calls.
It's understandable that the text format does not provide any information regarding shape, but what it less understandable is why the array property doesn't come with it when only a single row or a single column got copied.
For example:
That is simply rubbish.
The information in which formats data is available on the clipboard is provided by the "Formats" property. Naturally, Dyalog only supports standard formats. So any proprietary formats left behind by any other application is not available to an APL programmer, at least not without []NA calls.
It's understandable that the text format does not provide any information regarding shape, but what it less understandable is why the array property doesn't come with it when only a single row or a single column got copied.
For example:
'cl' ⎕wc'Clipboard'
⍝ after copying 3 rows and 2 columns
⍴cl.Array
3 2
⍝ after copying 3 rows and ONE column
⍴cl.Array
3
That is simply rubbish.
Re: Paste column into grid
I don't have msexcel but I do have open-office calc.
copy 3 rows by 1 column.
Then in APL:
⍴CL.Array
3
copy 1 row by 3 columns.
⍴CL.Array
1 3
if ooo is the same as excel then I guess you need:
⍴⍪CL.Array
copy 3 rows by 1 column.
Then in APL:
⍴CL.Array
3
copy 1 row by 3 columns.
⍴CL.Array
1 3
if ooo is the same as excel then I guess you need:
⍴⍪CL.Array
Re: Paste column into grid
I just repeated Phil's extension to Kai's example with Excel:
'cl' ⎕wc'Clipboard'
⍝ Copy 1 row and 3 columns into the clipboard
⍴cl.Array
1 3
⍝ Copy 3 rows and 1 column into the clipboard
⍴cl.Array
3
Same result as with ooo. Seem like for once in my life Bill is not the one to be pestered.
'cl' ⎕wc'Clipboard'
⍝ Copy 1 row and 3 columns into the clipboard
⍴cl.Array
1 3
⍝ Copy 3 rows and 1 column into the clipboard
⍴cl.Array
3
Same result as with ooo. Seem like for once in my life Bill is not the one to be pestered.
Re: Paste column into grid
The fact that there is a difference between a column vector and a single row means that there is no ambiguity. Inserting monadic comma-bar (⍪) forces a vector to be a 1 column matrix. This is the solution the original poster requires.