Leigh -
you have to handle the sign fix yourself. Something like this (adapted from
phrase m19)
would probably suffice:
fixsign=: '-'"_(]#[:i.#)@('_'"_=])}] NB. Replace '_' in y by '-'
Note this will change non-sign "_"s as well and it expects character input.
On the topic of negative numbers, you should be aware of a big potential
problem
with reading numbers from Excel: the OLE method returns numbers _as
formatted_
in the spreadsheet. This has a couple of unfortunate consequences: it
limits
precision
and can miss negative numbers. This latter case could happen because
Excel allows you to specify that negative numbers are indicated _solely_ by
color,
e.g. all negative numbers are red. This means you will read them as a
positive
number using OLE - there is no way around this as far as I know.
In answer to your second question, I believe the OLE routines rely on the
clipboard
to pass data. That's why, if you look at my OLEExcel.ijs script (
http://www.jsoftware.com/jwiki/Scripts/OLEExcel#head-3b3f840fd1f9d6e61bfdaa475164a145f4f8d592),
you'll see I define a CLIPMAX global that I determined empirically to be the
maximum
number of floating point numbers the clipboard would hold - YMMV.
Good luck...
On 3/22/07, Leigh J. Halliwell <[EMAIL PROTECTED]> wrote:
Dear J Forum:
First, thank you, Devon, for your answer. I will experiment with your
Excel
script. However, I'm wondering whether it might be simpler to convert my
rank-2 boxed array to characters, e.g., with clipfmt, whether or not I
pass
it to the clipboard (Question 2 below)
About this I have two questions:
1) clipfmt does not change the J negative sign to the usual hyphen, so
Excel
can't recognize negative numbers. I can adapt clipfmt to make the
substitution; but is there already a subroutine or primitive that does
this?
2) should I pass the formatted array to the clipboard (wdclipwrite), or
does
an OLE subroutine (e.g., jcmd, get, getB, getM) allow me to pass it
directly
to the specified cell of my active worksheet?
Thanks for the help.
Sincerely,
Leigh
...
--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm