> From: bill lam
> 
> text inside a spreadsheet cell can be multiline by forcing line break
> using alt-enter in window and linux.  I found that block of cells
> containing line break can be copy-and-paste within spreadsheet. But
> csv verbs inside J base library seemed cannot handle that.
> 
> eg, for cells
> -+-+-+
> |a|b|e|
> | |c| |
> | |d| |
> +-+-+-+
> |a|a|a|
> +-+-+-+
> 
> clipboard of csv as reported by wd'clippaste' will be
>   97 9 98 10 99 10 100 9 101 10 97 9 97 9 97{a.
 
The issue here is that, given only the string above, there is no way any 
routine can decide whether a LF represents the end of a record or a line break 
embedded in a field.

Interestingly when I create the described spreadsheet structure in Excel 2007, 
copy it to the clipboard and look at it using wd'clippaste' I get the following:

   a. i. wd 'clippaste'
97 9 34 98 10 99 10 100 34 9 101 13 10 97 9 97 9 97 13 10

Disregarding the LF/CRLF difference because of Windows, the interesting thing 
is that the cell containing the forced line breaks is enclosed with double 
quotes (34{a.)

As a result the following work:
   fixdsv wd 'clippaste'
+-+-----+--+
|a|b c d|e |
+-+-----+--+
|a|a    |a |
+-+-----+--+

i.e. fixdsv with its default left argument (field delimiter = TAB and string 
delimiter= ")

  (TAB;'"') fixdsv wd 'clippaste'
+-+-----+--+
|a|b c d|e |
+-+-----+--+
|a|a    |a |
+-+-----+--+ 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to