My apologies, I was multitasking a bit too much yesterday and I did not
correctly update the script I was using.
I tried your entire updated script (and the new wdooo) and it worked fine in
6.02-32.
I also tried oocalc and it worked fine in j6.02-32.
In J7.01-64, the Excel script crashes J. I'll have to try it in J7.01-32.
Thanks for the wdooo addon.
--
David Mitchell
On 10/4/2010 20:54, bill lam wrote:
> What is your test script? As you can see from the scripts that I attached,
>
> try.
> 'base temp'=. olecreate__p 'Excel.Application'
> oleget__p base ; 'workbooks'
> wb=. oleid__p temp
> olemethod__p wb ; 'open' ; f1
>
> All 'me' have already been removed.
>
>
> Пнд, 04 Окт 2010, David Mitchell писал(а):
>> I tried the modified code and it now fails here:
>>
>> |domain error: test
>> | oleget__p me ;base;'workbooks'
>> |test[7]
>>
>> I cannot find any definition of me.
>>
>> --
>> David Mitchell
>>
>> On 10/4/2010 10:24, bill lam wrote:
>>> I'm sorry, the original code was written some years ago but wdooo was
>>> written later and stopped. The name me should already be stored inside
>>> wdooo. Try if this works, beware possible line wrapping, and I'm not sure
>>> if f1 should contain the prefix 'file:////'
>>>
>>> < ----------------------------------------------------------------------->
>>> NB. Excel using vtable oleautomation
>>> NB. only works if ms office excel has been installed
>>> NB. (but I got no ms excel to test, use at your own risk.)
>>>
>>> 'require'~'tables/wdooo'
>>>
>>> cocurrent 'base'
>>>
>>> NB. MS Office Excel
>>> NB. some differences from VBA
>>> NB. cell position is (col,row) and 1-base
>>> NB. use olemethod and oleget/oleset
>>> test=: 3 : 0
>>> PATH=. jpath '~addons/tables/wdooo'
>>> f1=. 'file:///', PATH, '/test1.xls'
>>> smoutput f1
>>> p=. '' conew 'wdooo'
>>> try.
>>> 'base temp'=. olecreate__p 'Excel.Application'
>>> oleget__p base ; 'workbooks'
>>> wb=. oleid__p temp
>>> olemethod__p wb ; 'open' ; f1
>>> oleget__p base ; 'activeworkbook'
>>> awb=. oleid__p temp
>>> oleget__p awb ; 'worksheets' ; 1 NB. sheet 1-base
>>> aws=: oleid__p temp
>>> NB. write string into a cell
>>> oleget__p aws ; 'range' ; xlcell 3 10
>>> range=. oleid__p temp
>>> oleput__p range ; 'value' ; 'Ms Excel'
>>> oleput__p range ; 'numberformat' ; '@'
>>> olerelease__p range
>>> NB. write number into a cell
>>> oleget__p aws ; 'range' ; xlcell 4 10
>>> range=. oleid__p temp
>>> oleput__p range ; 'value' ; 123
>>> oleput__p range ; 'HorizontalAlignment' ; _4152 NB. xlRight
>>> 0xffffefc8
>>> olerelease__p range
>>> NB. write date into a cell
>>> oleget__p aws ; 'range' ; xlcell 5 10
>>> range=. oleid__p temp
>>> oleput__p range ; 'value' ; (-&36522) 76533 NB. 2007-2-28
>>> oleput__p range ; 'numberformat' ; 'yyyy-mmm-dd'
>>> olerelease__p range
>>> NB. save and cleanup
>>> (olerelease__p ::0:) aws
>>> VT_BOOL (oleput__p ::0:) base ; 'DisplayAlerts' ; 0
>>> (olemethod__p ::0:) awb ; 'save'
>>> (olemethod__p ::0:) awb ; 'close'
>>> (olerelease__p ::0:) awb
>>> (olerelease__p ::0:) wb
>>> (olemethod__p ::0:) base ; 'quit'
>>> VT_BOOL (oleput__p ::0:) base ; 'DisplayAlerts' ; 1
>>> (oledestroy__p ::0:) temp
>>> smoutput 'success'
>>> catch.
>>> smoutput oleqer__p ''
>>> end.
>>> destroy__p ''
>>> )
>>>
>>> xlcell=: 3 : 0
>>> 'c r'=. y
>>> c1=.<.c%26 [ c2=. 26|c
>>> ' '-.~(c1{' ABCDEFGHI'), (c2{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), ": 1+r
>>> )
>>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm